# Differential equation trouble

I am trying to solve the following differential equation:

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

If we make the substitution $z=2x+y$, then we get: $$\frac{\mathrm{d}z}{\mathrm{d}x}=2+\frac{\mathrm{d}y}{\mathrm{d}x}=2+2z^{2}$$

This is a separable ODE, and so we get

$$\frac{\mathrm{d}z}{2+2z^{2}}=\mathrm{d}x \implies \int\frac{\mathrm{d}z}{2+2z^{2}}=\int\mathrm{d}x \implies \frac{1}{2}\tan^{-1}(z)=x+C$$

Rearranging we get:

$$z=\tan(2x+C) \implies y=\tan(2x+C)-2x$$

However plugging the ODE into Mathematica gives:

$$y(x)=\frac{2}{4Ce^{4ix}-i}-2x-i$$

And I can't see any way to reconcile these two results? Have I made an assumption that I'm unaware of at some point throughout my solution, or have I done something completely wrong?

P.S: Code for Mathematica:

FullSimplify[DSolve[y'[x] == 2 (2 x + y[x])^2, y[x], x]]

• Your solution is correct. – Mhenni Benghorbal Dec 26 '13 at 16:57
• @MhenniBenghorbal Thank you for the confirmation! Is Mathematica's solution equivalent then, or is it a bug? – Thomas Russell Dec 26 '13 at 16:58
• It should be so. – Mhenni Benghorbal Dec 26 '13 at 16:58

\begin{align} y(x)&=\frac{2}{4Ce^{4ix}-i}-2x-i\\ &=\frac{2e^{-2ix}}{4Ce^{2ix}-ie^{-2ix}}-i-2x\\ &=\frac{2e^{-2ix}-4Cie^{2ix}-e^{-2ix}}{4Ce^{2ix}-ie^{-2ix}}-2x\\ &=\frac{e^{-2ix}-4Cie^{2ix}}{4Ce^{2ix}-ie^{-2ix}}-2x \end{align} Now, \begin{align} \tan(2x+K) &= \frac{\sin(2x+K)}{\cos(2x+K)}\\ &=\frac{e^{2ix+Ki}-e^{-2ix-Ki}}{i(e^{2ix+Ki}+e^{-2ix-Ki})}\\ &=\frac{e^{-2ix}-e^{2ix+2Ki}}{-ie^{2ix+2Ki}-ie^{-2ix}} \end{align} And so, if we let $4Ci=-e^{2Ki}$, we have $$y(x)=\tan(2x+K)-2x$$

Mathematica uses the complex logarithm to write down the solution: $$\tan^{-1} z=\frac i2 \log\left(\frac{1-i z}{1+i z}\right).$$ If you play a little with the Mathematica solution you will find exactly your own answer.

Comment: If you use Wolfram Alpha you also get the same solution as Mathematica but probably using the formula $tan(x)=i\frac{1-\exp(2ix)}{1+\exp(2ix)}$ you should derive the $y(x)=tan(2x+c)−2x$ form of solution.

Ignore Mathematica. I also get the solution to be $y(x) = \tan(2x+k)-2x$.

There will be some convoluted way of writing $\tan$ using Euler's formula, e.g.

$$\cos x \equiv \frac{1}{2}\left( \operatorname{e}^{\operatorname{i}\!x} + \operatorname{e}^{-\operatorname{i}\!x}\right)$$

• Can the down voter please explain why my answer was non-useful? The OP had originally accepted my answer as his/her favourite answer and another user has up-voted it. A down vote is totally irrational. – Fly by Night Dec 26 '13 at 23:19