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

where is a constant. The boundary conditions of the original variational problem were and . 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

This yields two simpler differential equations, namely

and

The first one implies that 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

Integrating twice we get the general solution

where and are arbitrary constants. Using and we find that and . Therefore the required final solution of the differential equation with the squared derivative is

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

so

or

and therefore

So the problem reduces to solving

Carrying out the integrations we get

which yields the general solution

Using the boundary conditions we find that and . Substituting these into the general solution we again find the final solution of the differential equation with the squared derivative to be