Problem 172
Medium Nonhomogeneous Equations

Solve the initial value problem y''cos y + (y')^2sin y = y'…

Solve the initial value problem $y''\cos y + (y')^2\sin y = y'$, with $y(-1)=\dfrac{\pi}{6}, \qquad y'(-1)=2$.

Explanation of Method

Reduction of order with $p=y'(y)$ turns the equation into a first-order linear ODE for $p(y)$, whose solution recombines into a separable equation solved in closed form.

Step 1: Reduction of order: $p$ as a function of $y$

The equation has no explicit $x$, so set $p=y'$ and treat $p$ as a function of $y$, giving $y''=p\,\dfrac{dp}{dy}$. Substituting produces $p\dfrac{dp}{dy}\cos y + p^2\sin y = p$. Dividing by $p$ (excluding the trivial branch $p\equiv0$) leaves the first-order equation

\[\frac{dp}{dy}\cos y + p\sin y = 1.\]

Step 2: A first-order linear equation for $p(y)$

Dividing by $\cos y$ gives $\dfrac{dp}{dy} + p\tan y = \sec y$, which is linear in $p(y)$. The integrating factor is $\mu(y)=\exp\int\tan y\,dy=\exp\bigl(-\ln|\cos y|\bigr)=\sec y$. Multiplying through by $\sec y$ yields

\[\frac{d}{dy}\bigl(p\sec y\bigr) = \sec^2 y.\]

Step 3: Integrating and applying $y'(-1)=2$

Integrating, $p\sec y=\tan y+C_1$, so $p=\cos y(\tan y+C_1)=\sin y+C_1\cos y$. At $x=-1$ we have $y=\pi/6$ and $p=y'=2$, hence $2=\sin\dfrac{\pi}{6}+C_1\cos\dfrac{\pi}{6}=\dfrac12+C_1\dfrac{\sqrt3}{2}$, which forces $C_1=\sqrt3$. Thus

\[y' = \sin y + \sqrt3\cos y.\]

Step 4: Amplitude–phase form

Since $\sin(\pi/3)=\sqrt3/2$ and $\cos(\pi/3)=1/2$, we can rewrite $\sin y+\sqrt3\cos y=2\sin\!\left(y+\dfrac{\pi}{3}\right)$. The equation therefore reduces to the separable first-order equation

\[y' = 2\sin\!\left(y+\frac{\pi}{3}\right).\]

Step 5: Separating and integrating

Separating variables gives $\dfrac{dy}{\sin(y+\pi/3)}=2\,dx$. Using $\displaystyle\int\dfrac{dy}{\sin(y+\alpha)}=\ln\left|\tan\!\left(\dfrac{y+\alpha}{2}\right)\right|$ with $\alpha=\pi/3$, we obtain $\ln\left|\tan\!\left(\dfrac{y}{2}+\dfrac{\pi}{6}\right)\right|=2x+C_2$. At $x=-1$, $y=\pi/6$ we have $\tan(\pi/12+\pi/6)=\tan(\pi/4)=1$, so $\ln 1=0=-2+C_2$ and $C_2=2$. Hence $\tan\!\left(\dfrac{y}{2}+\dfrac{\pi}{6}\right)=e^{2(x+1)}$.

Step 6: Solving for $y$

Taking arctangent, $\dfrac{y}{2}+\dfrac{\pi}{6}=\arctan\bigl(e^{2(x+1)}\bigr)$, and therefore

\[y = 2\arctan\bigl(e^{2(x+1)}\bigr) - \frac{\pi}{3}.\]

Step 7: Verification

At $x=-1$: $y=2\arctan(1)-\pi/3=2(\pi/4)-\pi/3=\pi/2-\pi/3=\pi/6$. $\checkmark$ Differentiating, $y'=\dfrac{4e^{2(x+1)}}{1+e^{4(x+1)}}$, so at $x=-1$ we get $y'=\dfrac{4}{1+1}=2$. $\checkmark$

That the original ODE holds identically follows from the construction: with $\theta=\arctan(e^{2(x+1)})$, the double-angle identity $\sin(2\theta)=2\tan\theta/(1+\tan^2\theta)$ recovers $y'=2\sin(y+\pi/3)=\sin y+\sqrt3\cos y$, which is the first-order equation of Step 3. That equation was obtained from the original second-order equation by the reversible substitution $p=y'(y)$.


Result

Final answer:

\[\boxed{\,y = 2\arctan\bigl(e^{2(x+1)}\bigr) - \frac{\pi}{3}\,}\]