Indefinite integral $\int x \sin(x) a(x) dx$ Suppose  $$a'(x)=b(x)$$ and $$b'(x)=a(x)$$
What is $$\int x \sin (x) a(x) dx$$
Thanks!
 A: Since ${\partial^2 a(x) \over \partial x^2} = a(x)$, we have
$a(x) = c1\ e^x + c2\ e^{-x}$.
Then $\int x\ \sin(x) (c1\ e^x + c2\ e^{-x})\ dx = \frac{1}{2} e^{-x} \left(\cos (x) \left(-\left(\text{c1} e^{2 x} (x-1)+\text{c2}
   (x+1)\right)\right)-x \sin (x) \left(\text{c2}-\text{c1} e^{2 x}\right)\right)$
A: In the general case: It can be determined that $a'' = b' = a$ and the following.
\begin{align}
I &= \int x \, a(x) \, \sin(x) \, dx.
\end{align}
Using integration by parts with $dv = \sin(x)$ and $u = x \, a(x)$, where
$$\int u \, dv \, dx = u \, v - \int du \, v \, dx$$,
leads to
\begin{align}
I = - x \, a(x) \, \cos(x) + \int x \, a'(x) \, \cos(x) \, dx + \int a(x) \, \cos(x) \, dx.
\end{align}
Applying integration by parts in similar manor on the first integral, $dv = \cos(x)$ and $u = x \, a'(x)$,
\begin{align}
I = x \, (b(x) \, \sin(x) - a(x) \, \cos(x)) - I - \int (b(x) \, \sin(x) - a(x) \, \cos(x) ) \, dx
\end{align}
which is seen to be 
\begin{align}
\int x \, a(x) \, \sin(x) \, dx = \frac{1}{2} \, \left[ x \, f(x) - \int f(x) \, dx \right] 
\end{align}
where $f(x) = b(x) \, \sin(x) - a(x) \, \cos(x)$. 
Now, the equations $a'(x) = b(x)$ and $b'(x) = a(x)$ lead to $a''-a = 0$ and $b'' - b=0$. Both of which have solutions of the form $c_{0} \, \cosh(x) + c_{1} \, \sinh(x)$. Under certain parameter choices the form of $f(x)$ can be reduced to readily known forms for easier computations.  
