# Differential equation solving

## Homework Statement

Which of the methods of finding analytic solutions of differential equations
could you use to solve this equation? Give reasons for

a
$$y+\frac{dy}{dx}tan(x) = 2 (\pi/4 \leq x < \pi/2)$$

b
$$\sqrt{t^2+9}\frac{dy}{dx}=y^2 (0<y)$$

## The Attempt at a Solution

The integrating factor method for both, the initial value part I dont have a problem with,

For part a, I hit a wall when it came to integrating for the solution

I got g(x)=1, and h(x)=2/tan(x)

the integrating factor I got as p(x)=exp(x)

Putting it all back together I came unstuck here

$$exp(x)y=\int{exp(x)2cot(x)} dx$$

Mainly because to get the same answer as wolphram alpha, I had to use the exp funion on the RHS to get rid of the LN that came from integrating the cotangent. Meaning then that I cant eliminate the exp from the LHS. So im confused and havent attempted part b yet, but I think it is also to be solved in the same way.

## Answers and Replies

Just re-read my post, not a lot of info for people to go on there :)

For part a I rearranged like so

$$\frac{dy}{dx} + y = \frac{2}{tan(x)}$$

The integrating factor

$$p=exp(\int{g(x)}dx)$$

g(x) = 1, h(x)=2/tan(x)

so the integrating factor is

$$p=exp(x)$$

Subbing this in gave

$$\frac{d}{dy}(exp(x)y)=exp(x)\frac{2}{tan(x)}$$

Integrating (here I know I am wrong, the problem is no doubt above somewhere)

$$exp(x)y=\int{exp(x)2cot(x)} dx$$

The standard integral of cot involves a natural log so I lose the exp I was hoping to cancel out, please someone explain what I did wrong.

Thanks!

Dick
Homework Helper
The problem is that y+y'*tan(x)=2 doesn't rearrange to y+y'=2/tan(x). If you divide one side by tan(x) you have to divide every term by tan(x). The y just sat there.

Thanks dick, I did it again and got a little further

p(x) = 1/tan(x)

Integrating gives p(x) = exp(ln(sin(x)))

Sub this into

$$\frac{d}{dx}(p(x)cot(x))=p(x)h(x) I eventually end up with sin(x)cot(x) = sin(x)2cot(x) !!!! Dick Science Advisor Homework Helper Thanks dick, I did it again and got a little further p(x) = 1/tan(x) Integrating gives p(x) = exp(ln(sin(x))) Sub this into [tex]\frac{d}{dx}(p(x)cot(x))=p(x)h(x) I eventually end up with sin(x)cot(x) = sin(x)2cot(x) !!!! The integrating factor p(x) is right. That's just sin(x), right? Then I can't tell what you did. What happened to y? You want to solve for y, yes? [tex]\frac{dy}{dx}+\frac{y}{tan(x)}=\frac{2}{tan(x)}$$

so ill take g(x) and h(x)
$$g(x)=\frac{1}{tan(x)}$$
and
$$h(x)=\frac{2}{tan(x)}$$

Rewriting again i get

$$p(x)\frac{dy}{dx}+p(x)g(x)y=p(x)h(x)$$

Pull out the differential

$$\frac{d}{dx}(p(x)y=p(x)h(x)$$

Direct integration

$$p(x)y=\int{p(x)h(x)} dx$$

$$sin(x)y=\int{sin(x)\frac{2}{tan(x)} dx$$

$$sin(x)y=-cos(x)\frac{2cos(x)}{sin(x)}$$

$$y = -cos^2(x)$$

:)

I think thats correct, so how do I tackle the initial value problem?

dextercioby
Homework Helper
Nope, you missed out a factor.

$$\frac{dy}{dx} + \frac{1}{\tan x} y = \frac{2}{\tan x}$$

The IF is $\sin x$ so that

$$\frac{d}{dx}\left( \sin x \, y(x) \right) = 2 \cos x$$

Now integrate and be careful with the integration constant.

Which factor did I miss out? Please show the steps I cant follow you.

Integrating i get

$$sin(x)y=2sin(x) + C$$

$$y=sin(x) + C$$

Last edited:
dextercioby
Homework Helper
Well, dividing this equation

$$\sin(x) \, y = 2 \sin(x) + C$$

through $\sin x$ gives

$$y(x) = 2 + \frac{C}{\sin x}$$

$$x \in \left[\frac{\pi}{4},\frac{\pi}{2}\right)$$

which is a little different than what you came up with...

Lol, you could say a little, but thanks for that I understand now. :)