# How can I solve the differential equation y'= sinx - xsinx ?

Apr 4, 2018

General solution for your differential equation is:

$y = \left(x - 1\right) \cos x - \sin x + C$

#### Explanation:

.

$y ' = \frac{\mathrm{dy}}{\mathrm{dx}} = \sin x - x \sin x$

To find $y$, we have to take the integral of $y '$:

$y = \int \left(\sin x - x \sin x\right) \mathrm{dx}$

$y = \int \sin x \mathrm{dx} - \int x \sin x \mathrm{dx} = - \cos x - I$

$I = \int x \sin x \mathrm{dx}$

The argument of the integral is product of two functions. As such, we will use integration by parts:

$u = x , \mathmr{and} \mathrm{dv} = \sin x \mathrm{dx}$

$\mathrm{du} = \mathrm{dx} , \mathmr{and} v = - \cos x$

$\int u \mathrm{dv} = u v - \int v \mathrm{du}$

$\int x \sin x \mathrm{dx} = - x \cos x - \int - \cos x \mathrm{dx} =$

$- x \cos x + \int \cos x \mathrm{dx} = - x \cos x + \sin x$

$I = - x \cos x + \sin x$

Let's plug it in:

$y = - \cos x - \left(- x \cos x + \sin x\right) = - \cos x + x \cos x - \sin x$

$y = \left(x - 1\right) \cos x - \sin x + C$

This is the solution to the differential equation in your problem statement.

Apr 4, 2018

The General Solution is:

$y = x \cos x - \sin x - \cos x + C$

#### Explanation:

We have:

$y ' = \sin x - x \sin x$

Using Leibniz's Notation we can write this as:

$\frac{\mathrm{dy}}{\mathrm{dx}} = \sin x - x \sin x$

Which is a First Order Ordinary Differential Equation, so we can "separate the variables" to get:

$\int \setminus \mathrm{dy} = \int \setminus \sin x - x \sin x \setminus \mathrm{dx}$

$y = \int \setminus \sin x \setminus \mathrm{dx} - \int \setminus x \sin x \setminus \mathrm{dx} + C$

The first integral is trivial, and we require Integration By Parts for the Second integral, as follows:

Let  { (u,=x, => (du)/dx,=1), ((dv)/dx,=sin x, => v,=-cosz ) :}

Then plugging into the IBP formula:

$\int \setminus \left(u\right) \left(\frac{\mathrm{dv}}{\mathrm{dx}}\right) \setminus \mathrm{dx} = \left(u\right) \left(v\right) - \int \setminus \left(v\right) \left(\frac{\mathrm{du}}{\mathrm{dx}}\right) \setminus \mathrm{dx}$

We have:

$\int \setminus \left(x\right) \left(\sin x\right) \setminus \mathrm{dx} = \left(x\right) \left(- \cos x\right) - \int \setminus \left(- \cos x\right) \left(1\right) \setminus \mathrm{dx}$

$\therefore \int \setminus x \sin x \setminus \mathrm{dx} = - x \cos x + \sin x$

$y = - \cos x - \left\{- x \cos x + \sin x\right\} + C$
$\setminus \setminus = - \cos x + x \cos x - \sin x + C$
$\setminus \setminus = x \cos x - \sin x - \cos x + C$