Problem Link — Domino-and-tromino-tiling-problem

In this edutorial there is two problem.

**part-1)** Some tiling problems (I **understand** this completely)

**part-2)** A more complicated tiling problem (I have **doubt** in this)

the recurrence relation is **f(n) = f(n-1) + f(n-2) + 2g(n-2)**

I have doubt in function g(n) → (covering n*2 grid using L-shaped tile) is the recurrence reletion (g(n-2) part explain little bit) is correct.

I got some explanation for this question but i have some doubt; please Help!!!

- The **Dp formula** for this question is this dp[n]=dp[n-1]+dp[n-2]+ 2*(dp[n-3]+…+d[0]) - according to my understanding the dp[n-1] and dp[n-2] is due to domino - and the 2*(dp[n-3]+…+d[0]) is due to tromino - can someone explain why the total number of tiling for the trominos is 2*(dp[n-3]+…+d[0]);

or if my understanding about **Dp formula** is wrong please correct me!!

please help!!!

The function

`g(n)`

is not covering n*2 grid using L-shaped tiles. It is for covering the n*2 grid with one extra block on either side, by usingeither dominos or by using L-shape, or both. Basically,`g(n)`

uses the fact that you will have to use another L-shape somewhere, which will convert it into a normal k*2 grid somewhere during tiling.The recurrence relation is

`g(n) = g(n-1) + f(n-1)`

.Now, keep substituting the value for

`g`

on RHS, we get something likeSince

`g(0) = 0`

, we get`g(n) = f(0) + f(1) + f(2) + ... + f(n-1)`

, orNow,

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

Substituting value of g in the equation, we getThe term

`2*(dp[n-3]+…+d[0])`

comes from last part of this equation.