# Calculate the energy of x[n]

I'm trying to calculate the energy of this signal: x[n] = $$(\frac{1}{2})^n\sin(\frac{\pi}{2}n).u[n]$$

$$E = \sum_{n=-\infty}^{+\infty}\left|\left(\frac{1}{2}\right)^n \sin\left(\frac{\pi}{2}n\right) u[n]\right|^2$$

I know the solution is $$E = \frac{4}{15}$$ but I can't find the way to calculate it.

It's always helpful to write down the first few elements and check if you can see the pattern. You can quickly see that $$\sin(\frac{\pi}{2}n)$$ is simply [0 1 0 -1 0 1 0 -1 ...]

So we have

$$y[n] = x^2[n] = \begin{bmatrix} 0 & 1/4 & 0 & 1/64 & 0 & 1/1024 & ... \\ \end{bmatrix}$$

The ratio between two non-zero element is always $$1/16$$. To use the geometric sum formula we want to write this a power series in $$1/16$$. We also need the first non-zero element to be 1, so we can just pull out a factor of 1/4, i.e.

$$y[n] = \frac{1}{4}\begin{bmatrix} 0 & 1 & 0 & 1/16 & 0 & 1/256 & ... \\ \end{bmatrix} = \frac{1}{4} \begin{bmatrix} 0 & (\frac{1}{16})^0 & 0 & (\frac{1}{16})^1 & 0 & (\frac{1}{16})^2 & ... \\ \end{bmatrix}$$

And then the energy simply becomes the sum over the non-zero elements, i.e.

$$E = \frac{1}{4}\sum_{k=0}^{\infty} (\frac{1}{16})^k = \frac{1}{4} \cdot\frac{1}{1-1/16} = \frac{1}{4} \cdot \frac{16}{15} = \frac{4}{15}$$

There is a more formal of doing this by properly substituting the summation indices but this feels easier and more intuitive to me.