# How would one solve the following equation?

This equation is giving me a hard time.

$$e^x(x^2+2x+1)=2$$

Can you show me how to solve this problem algebraically or exactly? I managed to solve it using my calculator with one of its graph functions. But I would like to know how one would solve this without using the calculator.

Highly appreciated,

Bowser.

Take the natural logarithm of both terms, getting

$$x + \ln(x^2 + 2x + 1) = \ln(2)$$

Now watch the log argument: you see it's a square! Indeed $x^2 + 2x + 2 = (x + 1)^2$ so, again using log property:

$$x + 2\ln(x+1) = \ln(2)$$

If we assume to expect small values as a solution, then we may use Taylor Series expansion for the logarithm, up to the second order:

$$\ln(1+x) \approx x - \frac{x^2}{2}$$

Thence:

$$x + 2x - x^2 - \ln(2) = 0 ~~~~~ \to ~~~~~ x^2 - 3x - \ln(2) = 0$$

Solving like a second degree equation gives

$$x = \frac{3\pm \sqrt{9 - 4\ln(2)}}{2}$$

$$x_1 = 2.747(..) ~~~~~~~~~~~ x_2 = 0.252(..)$$

This is a numerical method to solve it and as you see the second solution fits with your result.

That solution can be improved simple taking more terms in the log expansion, indeed:

$$\ln(x+1) \approx x - \frac{x^2}{2} + \frac{x^3}{3} \cdot$$

• You're welcome! Logarithm properties can be vital! – Turing Mar 3 '16 at 20:20
• Wait, I check the whole thing! – Turing Mar 3 '16 at 20:29
• The first step is false. It should be x instead of 1. – Friedrich Philipp Mar 3 '16 at 20:34
• Whoops! What a shame!! I'm going to fix it – Turing Mar 3 '16 at 20:36
• Thanks, you've given me some food for thought. I will study Lambert W Function and Taylor Series. God.. I love math! – Cro-Magnon Mar 3 '16 at 20:44

As you see, there are many ways to solve the equation.

I see two of them which have not been described.

• the first one is Newton method which, starting from a "reasonable" guess $x_0$ will update it according to $$x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}$$ So, let us consider $$f(x)=e^x \left(x^2+2 x+1\right)-2\qquad f'(x)=e^x (x+1) (x+3)$$ Being very lazy, I shall start using $x_0=0$. The method then generates the following iterates $$x_1=0.333333333333333$$ $$x_2=0.255772423091538$$ $$x_3=0.248843724711150$$ $$x_4=0.248792699431494$$ $$x_5=0.248792696686402$$ which is the solution for fifteen significant figures.

• the second one, which will lead to approximate solutions, uses Padé approximants which, for the same number of terms, are more "accurate" than Taylor series. Since I am still lazy and do not want to solve more than linear equations, I shall restrict to degree $1$ in numerator and degree $n$ in denominator. For example, I shall get $$P_{1,1}=\frac{\frac{25 x}{6}-1}{1-\frac{7 x}{6}}$$ $$P_{1,2}=\frac{\frac{301 x}{75}-1}{\frac{23 x^2}{50}-\frac{76 x}{75}+1}$$ $$P_{1,3}=\frac{\frac{4839 x}{1204}-1}{-\frac{521 x^3}{7224}+\frac{533 x^2}{1204}-\frac{1227 x}{1204}+1}$$ So, cancelling the numerators, approximations would be $$x_1=\frac{6}{25}=0.24$$ $$x_2=\frac{75}{301}\approx 0.249169$$ $$x_3=\frac{1204}{4839}\approx 0.248812$$

Being now less lazy and accepting to solve a quadratic, I could build $$P_{2,2}=\frac{\frac{521 x^2}{828}+\frac{533 x}{138}-1}{\frac{235 x^2}{828}-\frac{119 x}{138}+1}$$ for which the acceptable solution would be $$x=\frac{3}{521} \left(107 \sqrt{29}-533\right)\approx 0.248825$$

It is sure that we could do better and faster doing the same kind of work assuming (or knowing) that the solution is close to $\frac 14$. For example, the first iterate of Newton method would be $$\frac{1}{4}-\frac{16 \left(\frac{25 \sqrt[4]{e}}{16}-2\right)}{65 \sqrt[4]{e}}\approx 0.248794$$ and the solution of the $P_{1,1}$ approximant would be $$\frac{21024-7975 \sqrt[4]{e}}{4 \left(4384+5025 \sqrt[4]{e}\right)}\approx 0.248793$$

• I really appreciate that, thank you! – Cro-Magnon Mar 4 '16 at 13:14
• @Bowser. You are very welcome ! I had fun !! – Claude Leibovici Mar 4 '16 at 17:03

$$e^x(x+1)^2=2\implies e^{(x+1)/2}(x+1)/2=\sqrt{e/2}\implies(x+1)/2=\mathrm{W}\!\left(\sqrt{e/2}\right)$$ Therefore, $$x=2\mathrm{W}\!\left(\sqrt{e/2}\right)-1$$ where $\mathrm{W}$ is the Lambert W function.

There is an iterative algorithm given in this answer to compute $\mathrm{W}$.

Alternatively, N[2LambertW[Sqrt[E/2]]-1,20] in Mathematica yields $$x=0.24879269668640244047$$

The answer given by Desmos for intersection of the two curves $y=e^x$ and $y=\frac {2}{(x+1)^2}$ is $\color{red}{x=0.249}$. Now we have $$(x+1)^2=2e^{-1}\iff x^2+2x+1=2(1-x+\frac{x^2}{2}-\frac{x^3}{6}+\frac{x^4}{24}-\frac{x^5}{60}+O(x^6))$$ hence $$1-4x-\frac{x^3}{3}+\frac{x^4}{12}-\frac{x^5}{60}+20\cdot O(x^6)=0$$ The first approximation $1-4x=0$ gives $\color{red}{x\approx 0.25}$

The second approximation $1-4x-\frac{x^3}{3}=0$ gives $\color{red}{x\approx 0.24872}$

And we can continue but we see that the first approach is already good enough.