Evaluate $\int_0^{\pi/2}x e^x \sin(x)dx$. $$I=\int_0^{\pi/2}x e^x \sin(x)dx$$
I gave a lot of efforts in this question and replaced x with $\pi/2 -x $ but to no avail, this even became more complicated.
Kindly give me an  idea on how  to proceed in this very question.

Define $$S(x) = \int e^x \sin x \, dx, \quad C(x) = \int e^x \cos x \, dx.$$  Then with the choice $$u = \sin x, \quad du = \cos x \, dx, \\ dv = e^x \, dx, \quad v = e^x,$$ we find that $$S(x) = e^x \sin x - \int e^x \cos x \, dx = e^x \sin x - C(x).$$  Similarly, we find $$C(x) = e^x \cos x + \int e^x \sin x \, dx = e^x \cos x + S(x).$$  It follows that $$S(x) = \frac{e^x}{2}(\sin x - \cos x) + K, \\ C(x) = \frac{e^x}{2}(\sin x + \cos x) + K$$ for any constant of integration $K$; moreover, $$\int S(x) \, dx = \int \frac{e^x}{2}(\sin x - \cos x) \, dx = \frac{1}{2}(S(x) - C(x)) = -\frac{e^x}{2} \cos x + K.$$
Thus prepared, we now easily compute with the choice $$u = x, \quad du = dx, \\ dv = e^x \sin x \, dx, \quad v = S(x),$$
$$\begin{align*} \int x e^x \sin x \, dx &= x S(x) - \int S(x) \, dx \\
&= \frac{x e^x}{2} (\sin x - \cos x) + \frac{e^x}{2} \cos x + K \\
&= \frac{e^x}{2} (x \sin x + (1-x) \cos x) + K. \end{align*}$$  The value of the definite integral is straightforward.
