# Solving a nonlinear, first order ODE with a trig function

I have an equation of the form,

$$\frac{dy}{dx} = A(x) + B(x) \sin^2(y)$$

How would I go about solving this? Obviously were $$A(x) = 0$$ then this would be separable and all would be OK, however the presence of the $$A(x)$$ term is confusing me.

Thanks in advance for any guidance

• Do you have a specific equation in mind? Dec 16, 2019 at 18:51

## 3 Answers

Divide both sides by $$\sin^2(y)$$ to get

$$\csc^2(y)\frac{\mathrm dy}{\mathrm dx}=A(x)\csc^2(y)+B(x)$$

Apply a Pythagorean identity:

$$\csc^2(y)\frac{\mathrm dy}{\mathrm dx}=A(x)\cot^2(y)+A(x)+B(x)$$

Let $$u=\cot(y)$$ to get

$$-\frac{\mathrm du}{\mathrm dx}=A(x)u^2+A(x)+B(x)$$

which is a Riccati equation.

• But this is contingent on us knowing a particular solution to $u(x)$, correct? How would one obtain that? Dec 16, 2019 at 19:16
• This shows that the problem is equivalent to another problem which is not solvable in general. Depending on $A$ and $B$, this may be solvable though. Dec 16, 2019 at 19:19

You shouldn't expect a closed-form solution for general $$A(x)$$ and $$B(x)$$. Even for $$A(x)=x$$ and $$B(x)=1$$, or $$A(x)=1$$ and $$B(x)=x$$, Maple finds no closed-form solution. Of course numerical or series solutions are available.

• OK thank you. Could you point me in the direction of how a series solution would work? Dec 16, 2019 at 18:58
• Write $y(x) = a_0 + a_1 x + a_2 x^2 + \ldots$ (as many terms as you like), take series of left and right sides of the equation, and compare coefficients of each power of $x$. Solve the resulting equations to get $a_1, \ldots, a_N$ as functions of $a_0 = y(0)$. Dec 16, 2019 at 19:00
• Thus if $A(x) = x$ and $B(x)=1$, you get $$a_1 + 2 a_2 x + \ldots = \sin^2(a_0) + (1 + 2 \sin(a_0) \cos(a_0) a_1) x + \ldots$$ so $a_1 = \sin^2(a_0)$, $a_2 = 1/2 + \sin^3(a_0) \cos(a_0)$, etc. Dec 16, 2019 at 19:06
• You probably want to go through my answer and convert the problem into a second order linear equation if you want to apply Frobenius. Dec 16, 2019 at 19:08

You can solve it when $$A(x)=B(x)$$, then $$\frac{dy}{1+\sin^2 y}=A(x) dx \implies \int\frac{dy}{1+\sin^2y}=\int A(x) dx+C$$ $$\implies \int \frac{du}{1+2u^2}=\int A(x) dx +C \implies \frac{1}{\sqrt{2}} \tan^{-1} u\sqrt{2}, u=\tan y.$$ $$y(x)=\tan^{-1}\left\{\frac{1}{\sqrt{2}}\tan\left[ \sqrt{2}\left( \int A(x) dx+C \right)\right]\right\}$$