# Why we get different answers for this integral by parts?

The integral is :$$I=\int e^{\alpha x}\cos\beta xdx$$

To evaluate the integral I used integral by parts method twice. for first integral I used substitution $$u=e^{\alpha x}$$ and $$dv=\cos\beta x dx$$ and for second one $$dv=\sin\beta x$$ My final answer is $$I=\frac{\beta}{\alpha^2+\beta^2}e^{\alpha x}(\sin\beta x+\frac{\alpha}{\beta}\cos\beta x)+C$$

But the answer in the book I am studying is :

$$I=\frac{\alpha}{\alpha^2+\beta^2}e^{\alpha x}(\cos\beta x+\frac{\beta}{\alpha}\sin\beta x)+C$$

First I thought my answer is wrong but I took derivative of that and obtained $$e^{\alpha x}\cos\beta x$$. so I realized my answer is also correct.

I find out the reason for different answers is different substitution the book used $$u=\cos\beta x$$ and $$dv=e^{\alpha x}dx$$. My question is why we got different answers here for different $$u$$ and $$dv$$? Is there any mathematically logic that can explain this?

• Move $\beta$ inside the parantheses for the first version and $\alpha$ inside for the second. Jan 10, 2021 at 7:04
• @Semiclassical Oh they are the same. never thought about that! Jan 10, 2021 at 7:05

If $$F'(x)=G'(x)$$ then we have $$F(x)-G(x)=constant$$ so the difference related to constant. For example since we have $$\sin^2x+\cos^2x=1$$ then one can let $$\sin^2x=1-\cos^2x$$ or $$\cos^2x=1-\sin^2x$$ that is no basic differnce between $$\sin^2x$$ and $$\cos^2x$$ as answer of integrals.
• Also there is different between $\sin^2 x$ and $\cos^2 x$ as answer of integral. because one is $\sin^2 x$ plus a constant and another is $\color{red}{-}\sin^2 x$ plus a constant. Jan 10, 2021 at 10:47