# Help Solving Differential Equations

1. Oct 9, 2014

### JoshP-hillips

Q1.

x2dy/dx + xy = x2sinx

I believe it is a separable equation (first order linear)

First step is to rewrite into standard form;

dy/dx + (xy)/x2 = (x2sin(x))/x2

Then to calculate the integrating factor I(x);

I(x) = e|(xy)/x2dx = eylnx = elnxy = xy

Then i need to multiply both sides of the d.e. by I(x)

2. Oct 9, 2014

### Staff: Mentor

This part is wrong -- e|(xy)/x2dx. In standard form, your equation is dy/dx + (1/x)y = sin(x). The coefficient of the y term is just 1/x, not y/x. With that correction, what should your integrating factor be?

BTW, this is NOT a precalculus question, so I moved it to the appropriate forum section.

3. Oct 9, 2014

### JoshP-hillips

Thanks for the tip, and moving the thread.

Here's what I've done;

NEW standard form (from old one)

dy/dx + (1/x)y = sinx

Integrating factor now becomes

I(x) = e|(1/x)dx = elnx = x

Multiplying both sides of the d.e. by I(x) gives;

x dy/dx + x(1/x)y = x sinx

x dy/dx + y = x sinx

Rewriting as d/dx(I(x)y)

d/dx(xy) = x sinx

Integrating both sides with respect to x

xy = x|sinx

xy = sinx - x cosx

y = (sinx)/x - cosx + C/x

How'd I go?

Last edited: Oct 9, 2014
4. Oct 9, 2014

### PeroK

Differentiate what you got for y and plug it back into the original equation! That's what a solution to the equation means, after all.

5. Oct 9, 2014

### epenguin

I can't resist looking for a more elementary, simple way, of looking at it to see is there a simple
d(of something) there, although having your more general method which will see you algorithmically through all problems of a given category is no doubt more valuable generally.

So looking at that, x2dy/dx can come from d(x2y)/dx which is x2dy/dx + 2xy which is nearly what you want but the factor 2 spoils it and there is no way to fiddle constants to hammer it to what you want, so try to divide the equation by x and then d(xy)/dx works perfectly and gives the same solution result as yours.

Last edited: Oct 9, 2014
6. Oct 9, 2014

### HallsofIvy

Yes, that's the whole point of an "integrating factor". We want to find a function, u(x), such that multiplying dy/dx+ y/x by it will give a "complete differential". That is, we must have d(uy)/dx= u(dy/dx)+ (du/dx)y= u(dy/dx)+ (u/x)y. The "u(dy/dx)" terms cancel leaving du/dx= u/x. du/u= dx/x; ln(u)= ln(x)+ C, u= cx. Since we only need one such function, take c= 1. Then x(dy/dx+ y/x)= x(dy/dx)+ y= d(xy)/dx= xsin(x).

$xy= \int x sin(x)dx$. Use integration by parts on the right.

7. Oct 9, 2014

### Staff: Mentor

The 'I' character you're using to indicate an integral is very hard to spot, appearing identical to 'l' (lowercase L) and very close to '|' (vertical bar).
Why not write it as d/dx(xy)?
Why is the bar in there?
You tell us. Once you have found a solution to a differential equation, you can (and should) check it by verifying that your solution satisfies the DE.