# Initial Value Problem $\tan(x)y′+y=1$

Find the solution for the initial value problem $y(π/2)=0$.

$tan(x)y′+y=1$

I know the general solution is $y=1+\frac{C}{sin(x)}$

and for the IVP $y=1-\frac{1}{sin(x)}$.

I've tried two methods so far and gotten nowhere on the problem. I first tried moving everything over to the right side but $y'$ and then trying to integrate them. I got stuck at trying to do the integral of $dy=\frac{1-y}{tan(x)}$. I then tried to use the integrating factor, but the equation doesn't seem right for doing so. What's the best way to go about this problem?

I'm also confused by the answer to the IVP - I suspect I'm doing something wrong. I know $sin(\frac{π}{2})$ is $1$, so why is it $y=1-\frac{1}{sin(x)}$ instead of $y=1+\frac{1}{sin(x)}$ (why is the negative there?)

Thanks for the help.

• Anyone have an idea how to do this problem? Something tell me this is pretty simple, but I'm just missing the point. Still trying to figure out how to solve this problem. – user91971 Oct 3 '13 at 6:12

Do you see that it is separable and we can then use integration to write:

$$\displaystyle \int \frac{dy}{1-y} = \int \cot x dx$$

These integrals yield:

$$-\ln(-y + 1) = \ln(\sin x) + c$$

We want to isolate $y(x)$.

Taking exponentials of each side yields:

$$-y + 1 = e^{-\ln(\sin(x)-c} = \dfrac{c}{\sin x} = c ~ \csc x$$

This reduces to:

$$y(x) = c ~ \csc x +1$$

• I must have made a mistake somewhere - I get close to my answer, but just out of reach. I integrated the left side and got $-ln(1-y)$, on the right side I got $ln(sinx)$. I solved and ended up with $y=sinx+1$, which is so close to what I want, but not quite! What did I get wrong? Also another question about the separated equation you gave me. I split the equation up on my own and got $\frac{1-y}{y'}=tan(x)$. I'm assuming you took the inverse to get the equation you stated? – user91971 Oct 3 '13 at 6:54
• @user91971: Recall, we need $dy$ in the numerator, so we need to invert, and that is how I got $\cot x$. Clear? Your integrals are correct, but what if you take the exponential of each side because we want to isolate $y(x)$ by itself on the LHS. Clear? – Amzoti Oct 3 '13 at 14:18
• @user91971: I also added the final result (have to hover to see it. Regards – Amzoti Oct 3 '13 at 14:45
• I found my mistake - I forgot $-ln(1-y)$ lead to $\frac{1}{1-y}$, not $-1+y$. However, I ran into another problem. When I try to solve it, I get $y=1-Ccscx$ or $y=1-\frac{C}{sinx}$. I realize if I put a negative on the left hand side when I'm at $1-y=cscx$ I'll get to the answer successfully. Where was I supposed to put the negative sign in before? Thanks, and sorry for asking again. – user91971 Oct 3 '13 at 15:49
• I added more details. Recall, when I multiply by the negative, $c$ become $-c$, but that is still a constant, so is just shown as $c$. Your last comment was a good approach too, just note that $-c$ is just a constant and we are free to write it as $c$. You should upvote and/or accept the answer that helped you the most. Regards – Amzoti Oct 3 '13 at 15:56

Hint: Note that $$\tan(x)\cdot y'+y=\frac{\sin(x)\cdot y'+\cos(x)\cdot y}{\cos x}=\frac{\sin(x)\cdot y'+(\sin(x))'\cdot y}{\cos x}=\frac{(\sin(x)\cdot y)'}{\cos x}$$ hence one is trying to solve $$(\sin(x)\cdot y)'=\cos(x)=(\sin(x))'.$$ You might want to finish this...

• This is very useful, but it still hasn't clicked on me yet (I'm a dull person, sorry!). Am I supposed to substitute one of those 3 equations back into $tan(x)*y'+y$ to get something like $cos(x)=1$? Wait...I probably did something wrong here, didn't I? – user91971 Oct 3 '13 at 6:43
• You are not supposed to substitute anything into anything, this IS your equation. To sum up, your equation is $\sin(x)y'+\cos(x)y-\cos(x)=0$ (agreed?) and the LHS of THAT is $(\sin(x)y-\sin(x))'$. Hence... – Did Oct 3 '13 at 6:45
• (Dullness is hugely less relevant to learning maths than people estimate it to be.) – Did Oct 3 '13 at 6:46
• Ah, I solved from there and got my answer, thank! I've never tried anything like this method before, but I can see how it works now. I have one question. You simplified the equation to $(sin(x)y-sin(x))'$. I can see that the first part comes from $sin(x)y'$ and the second part comes from $-cos(x)$, but what happened to the $cos(x)y$? I feel as if I'm making another silly mistake, but I just want to figure out this problem completely. Thanks! – user91971 Oct 3 '13 at 7:03
• Try (slowly) to compute $(\sin(x)y)'$ and thou shalt see the light... :-) – Did Oct 3 '13 at 7:31

You cannot define the initial condition like that because $\tan x$ is not defined at $x=\pi/2$. With that form it is meaningless to talk about existence of the solution to the given IVP. Actually even you find the general solution of the equation you will see that constant $C$ appearing in the solution is not determined by using the initial condition.

Your differential equation only makes sense in the interval $-{\pi\over2}<x<{\pi\over2}$ and its translates by integer multiples of $\pi$, since $\tan x$ is not defined at odd multiples of ${\pi\over2}$. Given such an interval $I$ an additional obstacle will show up: As $\cos x\ne0$ in $I$ your differential equation is equivalent with $$y'\ \sin x+y\ \cos x-\cos x=0\qquad(x\in I)\ ,$$ which is the same as $$\bigl((y-1)\ \sin x\bigr)'=0\qquad(x\in I)\ .$$ It follows that there is a constant $C\in{\mathbb R}$ such that $(y-1)\sin x=C$. As $\sin x=0$ for the midpoint of $I$ the only solution that is defined in all of $I$ is the function resulting from $C=0$, i.e., the constant function $y(x)\equiv1$. There are further solutions which are defined only in the left or the right half of $I$, given by $$y(x)={C\over \sin x}+1$$ with an arbitrary $C$. It is possible to concatenate two such solutions over an odd multiple $\xi$ of ${\pi\over2}$, but at the point $\xi$ the given differential equation makes no sense.