I see the following sequence and it's: $$h=1+4+4^2+\cdots+4^{X+Y}=\frac{4^{X+Y+1}-1}{4-1}$$
how we get this sequence?
I know this is a primary question but I confused :)
I see the following sequence and it's: $$h=1+4+4^2+\cdots+4^{X+Y}=\frac{4^{X+Y+1}-1}{4-1}$$
how we get this sequence?
I know this is a primary question but I confused :)
This is an example of a geometric series. Let's say we try to sum: $$S=1+r+r^2+r^3+\dotsb+r^n$$ In your example, $r=4$, and $n=X+Y$.
There is a well known "trick" for solving this. Multiply by $r$: $$Sr=r+r^2+r^3+\dotsb+r^n+r^{n+1}$$ Notice how this is the same thing as $S$, except without the $1$ at front and with an extra $r^{n+1}$ at the end. In fact: $$Sr=S-1+r^{n+1}$$ Solving: \begin{align} Sr&=S-1+r^{n+1} \\ Sr-S&=-1+r^{n+1} \\ S(r-1)&=r^{n+1}-1 \\ S&=\frac{r^{n+1}-1}{r-1} \end{align}
$$\fbox{$1+r+r^2+r^3+\dotsb+r^n=\dfrac{r^{n+1}-1}{r-1}$}$$
Plugging in $r=4$ and $n=X+Y$, we get your answer.