What is f(x) = int (2-xe^x)(e^x+cosx) dx if f(0 ) = 2 ?

1 Answer

color(blue)(f(x)=2e^x+2sin x-1/2xe^(2x)+1/4e^(2x)-1/2xe^x sin x-1/2xe^x cos x+1/2e^xsin x-1/4)

Explanation:

From the given
f(x)=int (2-xe^x)(e^x+cos x) dx

My solution begins with the expansion of the integrand by multiplying the two binomials

f(x)=int (2-xe^x)(e^x+cos x) dx

f(x)=int (2e^x+2cos x-xe^(2x)-xe^xcos x) dx

f(x)=
int 2e^x* dx+ int 2cos x* dx-int xe^(2x)* dx- int xe^xcos x* dx

Integrate each term of the integrand separately

First term
int 2e^x* dx=color(red)(2e^x+C_0)

Second term
int 2cos x* dx=color(red)(2sin x+C_1)

Third term-by integration by parts int u* dv=uv-int v*du
Let u=x and dv=e^(2x)dx and v=1/2e^(2x) and du=dx
int xe^(2x)* dx=color(red)(1/2xe^(2x)-1/4e^(2x)+C_2)

Fourth term-by integration by parts
Let u=x and dv=e^x cos x* dx and v=1/2e^xsin x+1/2e^xcos x and du=dx

int xe^xcos x* dx=color(red)(1/2xe^xsin x+1/2xe^xcos x-1/2e^xsin x+C_3)

Add all these integration
f(x)=2e^x+2sin x-(1/2xe^(2x)-1/4e^(2x))-(1/2xe^xsin x+1/2xe^xcos x-1/2e^xsin x)+C

color(red)(f(x)=2e^x+2sin x-1/2xe^(2x)+1/4e^(2x)-1/2xe^xsin x-1/2xe^xcos x+1/2e^xsin x+C)

But f(0)=2

f(0)=2=2e^0+2sin (0)-1/2(0)e^(2(0))+1/4e^(2(0))-1/2(0)e^(0)sin (0)-1/2(0)e^(0)cos (0)+1/2e^(0)sin (0)+C

2=2(1)+2(0)-0+1/4*(1)-0-0+0+C

color(red)(C=-1/4)

Final answer

color(blue)(f(x)=2e^x+2sin x-1/2xe^(2x)+1/4e^(2x)-1/2xe^x sin x-1/2xe^x cos x+1/2e^xsin x-1/4)

God bless...I hope the explanation is useful.