2.76   ODE No. 76

  1. Problem in Latex
  2. Mathematica input
  3. Maple input

\[ -a \cos (y(x))+b+y'(x)=0 \] Mathematica : cpu = 0.106016 (sec), leaf count = 51

\[\left \{\left \{y(x)\to 2 \tan ^{-1}\left (\frac {(a-b) \tanh \left (\frac {1}{2} \sqrt {a^2-b^2} \left (x-c_1\right )\right )}{\sqrt {a^2-b^2}}\right )\right \}\right \}\]

Maple : cpu = 0.075 (sec), leaf count = 41

\[ \left \{ y \left ( x \right ) =2\,\arctan \left ( {\frac {\tanh \left ( 1/2\,\sqrt {{a}^{2}-{b}^{2}} \left ( x+{\it \_C1} \right ) \right ) \sqrt {{a}^{2}-{b}^{2}}}{a+b}} \right ) \right \} \]

Hand solution

\[ y^{\prime }=a\cos y+b \]

This is separable.

\begin {align} \frac {dy}{a\cos y+b} & =dx\nonumber \\ \int \frac {dy}{a\cos y+b} & =x+C\tag {1} \end {align}

Using standard Tangent half-angle substitution, let \(t=\tan \frac {y}{2},\cos y=\frac {1-t^{2}}{1+t^{2}},dy=\frac {2}{1+t^{2}}dt\), then the integral becomes

\begin {align*} \int \frac {dy}{a\cos y+b} & =\int \frac {2}{1+t^{2}}\frac {1}{\left ( a\frac {1-t^{2}}{1+t^{2}}+b\right ) }dt\\ & =2\int \frac {1+t^{2}}{\left ( 1+t^{2}\right ) \left ( a\left ( 1-t^{2}\right ) +b\left ( 1+t^{2}\right ) \right ) }dt\\ & =2\int \frac {dt}{a-at^{2}+b+bt^{2}}\\ & =2\int \frac {dt}{\left ( a+b\right ) +t^{2}\left ( b-a\right ) }\\ & =2\int \frac {dt}{\left ( a+b\right ) \left ( 1+\frac {t^{2}\left ( b-a\right ) }{\left ( a+b\right ) }\right ) }\\ & =\frac {2}{a+b}\int \frac {dt}{\left ( 1+\frac {t^{2}\left ( b-a\right ) }{\left ( a+b\right ) }\right ) } \end {align*}

Let \(z^{2}=\frac {t^{2}\left ( b-a\right ) }{\left ( a+b\right ) }\), or \(z=\frac {t\sqrt {b-a}}{\sqrt {a+b}}\), then \(\frac {dz}{dt}=\frac {\sqrt {b-a}}{\sqrt {a+b}}\) and the above integral becomes

\begin {align*} \frac {2}{a+b}\int \frac {dt}{\left ( 1+\frac {t^{2}\left ( b-a\right ) }{\left ( a+b\right ) }\right ) } & =\frac {2}{a+b}\int \frac {\sqrt {a+b}}{\sqrt {b-a}}\frac {dz}{\left ( 1+z^{2}\right ) }\\ & =\frac {2}{a+b}\frac {\sqrt {a+b}}{\sqrt {b-a}}\int \frac {dz}{\left ( 1+z^{2}\right ) }\\ & =\frac {2}{\sqrt {a+b}}\frac {1}{\sqrt {b-a}}\int \frac {dz}{\left ( 1+z^{2}\right ) }\\ & =\frac {2}{\sqrt {\left ( a+b\right ) \left ( b-a\right ) }}\int \frac {dz}{\left ( 1+z^{2}\right ) }\\ & =\frac {2}{\sqrt {b^{2}-a^{2}}}\int \frac {dz}{\left ( 1+z^{2}\right ) } \end {align*}

Now, \(\int \frac {dz}{\left ( 1+z^{2}\right ) }=\arctan \left ( z\right ) \), hence

\begin {align*} \frac {2}{\sqrt {b^{2}-a^{2}}}\int \frac {dz}{\left ( 1+z^{2}\right ) } & =\frac {2}{\sqrt {b^{2}-a^{2}}}\arctan \left ( z\right ) \\ & =\frac {2}{\sqrt {b^{2}-a^{2}}}\arctan \left ( \frac {t\sqrt {b-a}}{\sqrt {a+b}}\right ) \end {align*}

But \(t=\tan \frac {y}{2}\) therefore

\[ \frac {2}{\sqrt {b^{2}-a^{2}}}\arctan \left ( \frac {t\sqrt {b-a}}{\sqrt {a+b}}\right ) =\frac {2}{\sqrt {b^{2}-a^{2}}}\arctan \left ( \frac {\tan \left ( \frac {y}{2}\right ) \sqrt {b-a}}{\sqrt {a+b}}\right ) \]

Going back to (1)

\begin {align*} \int \frac {dy}{a\cos y+b} & =x+C\\ \frac {2}{\sqrt {b^{2}-a^{2}}}\arctan \left ( \frac {\tan \left ( \frac {y}{2}\right ) \sqrt {b-a}}{\sqrt {a+b}}\right ) & =x+C\\ \arctan \left ( \frac {\tan \left ( \frac {y}{2}\right ) \sqrt {b-a}}{\sqrt {a+b}}\right ) & =\frac {1}{2}\sqrt {b^{2}-a^{2}}\left ( x+C\right ) \\ \frac {\tan \left ( \frac {y}{2}\right ) \sqrt {b-a}}{\sqrt {a+b}} & =\tan \left ( \frac {1}{2}\sqrt {b^{2}-a^{2}}\left ( x+C\right ) \right ) \\ \tan \left ( \frac {y}{2}\right ) & =\frac {\sqrt {a+b}}{\sqrt {b-a}}\tan \left ( \frac {1}{2}\sqrt {b^{2}-a^{2}}\left ( x+C\right ) \right ) \\ \frac {y}{2} & =\arctan \left ( \frac {\left ( a+b\right ) }{\sqrt {\left ( a+b\right ) \left ( b-a\right ) }}\tan \left ( \frac {1}{2}\sqrt {b^{2}-a^{2}}\left ( x+C\right ) \right ) \right ) \\ & =\arctan \left ( \frac {\left ( a+b\right ) }{\sqrt {b^{2}-a^{2}}}\tan \left ( \frac {1}{2}\sqrt {b^{2}-a^{2}}\left ( x+C\right ) \right ) \right ) \\ y & =2\arctan \left ( \frac {a+b}{\sqrt {b^{2}-a^{2}}}\tan \left ( \frac {1}{2}\sqrt {b^{2}-a^{2}}\left ( x+C\right ) \right ) \right ) \end {align*}

Verification

ode:=diff(y(x),x)=a*cos(y(x))+b; 
my_sol:=2*arctan( (a+b)/sqrt(b^2-a^2) * tan(1/2*sqrt(b^2-a^2)*(x+_C1))); 
odetest(y(x)=my_sol,ode); 
0