# Alternative approaches for a differential equation involving the square of a derivative

In the course of working out a calculus of variations problem I came across the nonlinear first-order differential equation

$\big( \frac{\mathrm{d} y}{\mathrm{d} x}\big)^2 + y = c$

where $c$ is a constant. The boundary conditions of the original variational problem were $y(0) = 0$ and $y(1) = 1$. Differential equations involving squares of derivatives can be tricky and I decided to take the opportunity to try to find at least a couple of different ways of solving this relatively simple one that might be applicable in harder cases. I want to record these here. (The reader should pause at this point and try to solve this equation by himself/herself before continuing).

One approach that worked nicely and that is generalisable to more difficult cases is to differentiate the equation, giving

$2y^{\prime} y^{\prime \prime} + y^{\prime} = 0$

$\iff$

$y^{\prime}(2 y^{\prime \prime} + 1) = 0$

This yields two simpler differential equations, namely

$y^{\prime} = 0$

and

$2y^{\prime \prime} + 1 = 0$

The first one implies that $y$ is a constant but this is not consistent with the boundary conditions. We therefore ignore this one and the problem then reduces to solving the second simple second-order differential equation, which can be written as

$\frac{\mathrm{d}^2 y}{\mathrm{d} x^2} = -\frac{1}{2}$

Integrating twice we get the general solution

$y = -\frac{1}{4} x^2 + c_1 x + c_2$

where $c_1$ and $c_2$ are arbitrary constants. Using $y(0) = 0$ and $y(1) = 1$ we find that $c_1 = \frac{5}{4}$ and $c_2 = 0$. Therefore the required final solution of the differential equation with the squared derivative is

$y = -\frac{1}{4} x^2 + \frac{5}{4} x$

The other approach I tried and that worked in this case was to rearrange the equation with the squared derivative directly in order to use separation of variables. Again this is something that might be worth trying in more difficult situations. In the present case we have

$\big( \frac{\mathrm{d} y}{\mathrm{d} x}\big)^2 + y = c_1$

so

$(\mathrm{d} y)^2 = (c_1 - y) (\mathrm{d} x)^2$

or

$\big(\frac{\mathrm{d} y}{\sqrt{c_1 - y}}\big)^2 = (\mathrm{d} x)^2$

and therefore

$\big(\int \frac{\mathrm{d} y}{\sqrt{c_1 - y}}\big)^2 = (\int \mathrm{d} x)^2$

So the problem reduces to solving

$\int \frac{\mathrm{d} y}{\sqrt{c_1 - y}} = \int \mathrm{d} x$

Carrying out the integrations we get

$-2 \sqrt{c_1 - y} = x + c_2$

which yields the general solution

$y = c_1 - \frac{1}{4} x^2 - \frac{1}{2} c_2 x - \frac{1}{4} c_2^2$

Using the boundary conditions we find that $c_1 = \frac{25}{16}$ and $c_2 = -\frac{5}{2}$. Substituting these into the general solution we again find the final solution of the differential equation with the squared derivative to be

$y = -\frac{1}{4} x^2 + \frac{5}{4} x$