Why do these recurrences determine the number of ways of tiling a 3xN rectangle with 2x1 dominoes? http://www.algorithmist.com/index.php/UVa_10918

The above link is a solution to UVa 10918 Problem. The problem is based on Dynamic Programming. I am not able to understand this approach to the problem. I have coded the solution but the approach is completely different. I want to understand the given approach. The problem is:

Determine in how many ways can a 3xN rectangle be completely tiled with 2x1 dominoes.

I only want to know how these recurrence relations came:

f(n)=f(n-2)+2*g(n-1)
g(n)=f(n-1)+g(n-2)


where f(n)=number of tilings of a 3xN rectangle
g(n)= number of tilings of a 3xN rectangle with one of its corner squares removed
The picture should say more than words.