Evaluating the integral: $ I = \int e^{\frac xa} \sin x \, \mathrm dx$ 
Evaluating the integral:
$$ I = \int e^{\frac xa} \sin x \, \mathrm dx \tag {1}$$


This question was asked in CBSE Board 12th Grade (India). So, here was the approach I made.
Proposition 1: $$ for, \, y= u(x), \forall \, x \in \mathbb{R} $$
$$ \int e^{\frac xa} u(x) \, \mathrm dx =  a e^{\frac xa} \left ( au(x) - a^2\dfrac{\mathrm du(x)}{\mathrm dx} + a^3\dfrac{\mathrm d^2u(x)}{\mathrm dx^2} - \dots \right ) \quad \dots\tag {*} $$
Proof: This can easily be proved by applying by parts in LHS and subtracting it with RHS to a quantity which can be made small than any other assignable quantity as required.

So, using the same to evaluate the integral $(1)$, we get:
$$I = ae^{\frac xa} \left ( (\sin x) - (\cos x) + (-\sin x) - (-\cos x) + (\sin x) - (\cos x) + (-\sin x) - (-\cos x) + (\dots) \right) $$
Clearly, the repetitions of sine and cosine functions inside the brackets in RHS are cancelling each other, so irrespective of the value of $x$, the series should converge to '0'.
$$\therefore I = 0$$
But, wait, the integrand is continuous and is strictly increasing and strictly decreasing for particular intervals of $x$. This is enough to show that my answer is wrong, but what I missed?

Edit: This question is more like why my approach failed then What is the correct way to find the solution of the question
Edit 2: Thanks to @J.G for pointing out that my proposition had issues. I've fixed that part now :)
 A: HINT
\begin{align*}
\int\exp\left(\frac{x}{a}\right)\sin(x)\mathrm{d}x = a\exp\left(\frac{x}{a}\right)\sin(x) - a\int\exp\left(\frac{x}{a}\right)\cos(x)\mathrm{d}x
\end{align*}
Analogously, we have
\begin{align*}
\int\exp\left(\frac{x}{a}\right)\cos(x)\mathrm{d}x = a\exp\left(\frac{x}{a}\right)\cos(x) + a\int\exp\left(\frac{x}{a}\right)\sin(x)\mathrm{d}x
\end{align*}
Therefore we have
\begin{align*}
\int\exp\left(\frac{x}{a}\right)\sin(x)\mathrm{d}x = a\exp\left(\frac{x}{a}\right)(\sin(x) - a\cos(x)) - a^{2}\int\exp\left(\frac{x}{a}\right)\sin(x)\mathrm{d}x
\end{align*}
Can you take it from here?
A: There are several issues here.


*

*Your $(\ast)$ should read $\int e^{x/a}u(x)dx=e^{x/a}(au-a^2u^\prime+a^3u^{\prime\prime}-\cdots)+C$.

*We have $\int e^{x/a}\sin xdx=e^{x/a}(a\sin x-a^2\cos x-a^3\sin x+\cdots)+C$. Thanks to the powers of $a$, you can use a geometric series, $\frac{a}{1+a^2}e^{x/a}(\sin x-a\cos x)+C$. You can verify by differentiation this is correct.

*There are certain convergence issues we have to either address or gloss over to use $(\ast)$, or the geometric series above. (You can understand the $a\to1^-$ limit with a careful understanding of this.) A safer approach is @user1337's or, if you're happy with complex methods, $$\int e^{x/a}\sin xdx=\Im\int e^{(1/a+i)x}dx=\Im\frac{1}{1/a+i}e^{(1/a+i)x}+C,$$which gets you to the above result fairly quickly. (For complex $a$, write the integrand as $\frac{e^{(1/a+i)x}-e^{(1/a-i)x}}{2i}$ instead.)

