Find the definite integral $\int_0^{\pi} 4^{-x}\sin(nx)dx$ Please, help me to solve the following definite integral: 
$\int_0^{\pi} 4^{-x}\sin(nx)dx$, where $n = const$.
I don't even know where to start.
 A: Integrating by parts:
$$\begin{eqnarray*}I(n)=\int_{0}^{\pi}e^{-x\log 4}\sin(nx)\,dx &=& \left.-\frac{1}{\log 4}e^{-x\log 4}\sin(nx)\right|_{0}^{\pi}+\int_{0}^{\pi}\frac{n}{\log 4}e^{-x \log 4}\cos(nx)\,dx\\&=&\left.-\frac{n}{\log^2 4}e^{-x\log 4}\cos(nx)\right|_{0}^{\pi}-\int_{0}^{\pi}\frac{n^2}{\log^2 4}e^{-x\log 4}\sin(nx)\,dx\end{eqnarray*}$$
hence we get:
$$\left(1+\frac{n^2}{\log^2 4}\right) I(n) = \frac{n}{\log^2 4}\left(1-(-1)^n 4^{-\pi}\right) $$ 
from which:

$$ I(n) = \frac{n}{n^2+\log^2 4}\left(1-(-1)^n 4^{-\pi}\right).$$

A: We present here an approach that circumvents our needing to integrate by parts.
First, we use Euler's Formula to write $\sin (nx)=\text{Im}\{e^{inx}\}$.  
We also write $4^{-x}$ in natural exponential form as $4^{-x}=e^{-\log(4)x}$.  
Then, proceeding directly, we have
$$\begin{align}
\int_0^\pi 4^{-x}\sin(nx)\,dx&=\text{Im}\left(\int_0^\pi e^{\left(-\log(4)+in\right)x}\,dx\right)\\\\
&=\text{Im}\left(\left. \frac{e^{\left(-\log(4)+in\right)x}}{-\log(4)+in}\right|_0^\pi\right)\\\\
&=\text{Im}\left(\frac{(-1)^n4^{-\pi}-1}{-\log(4)+in}\right)\\\\
&=\frac{\left(1-(-1)^n4^{-\pi}\right)n}{\log^2(4)+n^2}
\end{align}$$
A: I'll evaluate without the interval, as this is a complete mess.
Integrating by parts twice, setting $u = 4^{-x}$ and $du = -\ln(4)4^{-x}dx$ and $dv = \sin(nx)dx$ and $v = -\frac{1}{n}\cos(nx)$ and similarly with the resulting integral but with $\cos(nx)$, 
$$I = -\frac{\cos(nx)}{n4^x} - \frac{\ln(4)}{n}\int 4^{-x}\cos(nx) dx = -\frac{cos(nx)}{n4^x} - \frac{\ln(4)}{n}(\frac{\sin(nx)}{n4^x} + \frac{\ln(4)}{n} I).$$ 
Expanding and collecting like terms (the integrals I), we get
$$ I = \left(-\frac{\cos(nx)}{n4^x} - \frac{\ln(4)\sin(nx)}{n^24^x}\right)\frac{n^2}{n^2 + \ln^2(4)} = \frac{-(n\cos(nx) + \ln(4)\sin(nx))}{(n^2 + \ln^2(4))4^x}.$$
The key part to notice about this integral is that with a $\sin(x)$ or $\cos(x)$ function, often times repeating the integration by parts twice will return an integral that looks like the original. This allows you to setup an equation that looks like $I = f(x) + aI$. You can then solve to get $I = \frac{f(x)}{1 - a}$. This is a common method that should be studied closely (if you want to, say, pass an exam).
