# Separation of variables exercise 2

## Exercise:

\begin{align}(x^2+1)\cdot y’ &= 2x \cdot y^2 \\\\ x(0) &= \frac{1}{2}\end{align}

## Solution:

We bring the factor x to the right side and use for y’ the other notation dy/dx

\begin{align}(x^2+1)\cdot y’ &= 2x \cdot y^2 \\\\ y’ &= (x^2+1)^{-1}\cdot 2x \cdot y^2 \\\\ \frac{dy}{dx} &= (x^2+1)^{-1} \cdot 2x\cdot y^2\end{align}

We use dy/dx like a fraction and bring the “denominator” dx to the right side and all y to the left side

\begin{align}y^{-2} dy &= (x^2+1)^{-1}\cdot 2x \; dx\end{align}

Now we integrate both sides

\begin{align}\int y^{-2} dy &= \int (x^2+1)^{-1}\cdot 2x \; dx \\\\ -y^{-1} &= \int (x^2+1)^{-1}\cdot 2x \; dx \end{align}

For the right side we use the substitution rule for integrals:

\begin{align}u(x) := x^2+1\end{align}

The derivation is

\begin{align}\frac{du}{dx} &= 2x \\\\ du &= 2x \; dx \end{align}

We can plug this in

\begin{align}\int (x^2+1)^{-1}\cdot 2x \; dx \\\\ &= \int u^{-1}du \\\\ &= ln(u)+c, \; c\in \mathbb{R}\end{align}

Resubstituation

\begin{align}-y^{-1} &= ln(x^2+1)+c \\\ y &= -(ln(x^2+1)+c)^{-1}\end{align}

To find the particular solution we plug in 0 for x and 1/2 for y^2

\begin{align}y(0) &= \frac{1}{2} \\\ -(ln(0^2+1)+c)^{-1} &= \frac{1}{2} \\\ c &= -2\end{align}

WiWe found c and can plug this in the general solution to find the solution for our initial value problem

$$y(x) = -(ln(x^2+1)-2)^{-1}$$