# Show that $y =e-x^2e^x$ has an $x$-intercept at $x = 1$

Show that $$y =e-x^2e^x$$ has an $x$-intercept at $x = 1$.

My Process:

$x$-intercept when $y=0$, so \begin{align*} e-x^2e^x&=0\\ -x^2&=0\\ x&=0 \end{align*}

However when I graphed this function online, I could see that $x$-intercept is $1$ but I don't know the process to get there?

• How can you go from $e-x^2e^x = 0$ to $-x^2 = 0$? – Dirk Apr 24 '17 at 8:28
• Second line down should read $e^1 = x^2 e^x$ – Kevin Apr 24 '17 at 8:30
• You can't cancel out e and $e^x$ you see? – Iti Shree Apr 24 '17 at 8:32

You are making this harder than it needs to be. You don't need to solve $y =e-x^2e^x$ for $y=0$. You have been given that the x-intercept is 1, so you simply need to verify that statement. In other words, just plug $x=1$ into the equation and verify that it gives $y=0$.

$$y = e-x^2e^x$$ Let $x=1$ $$y = e-1^2e^1$$ $$y = e-e = 0$$

So 1 is the x-intercept.

From the plot of the equation it appears that there's only one x-intercept. We can get some more info about the behaviour of the function by using a little calculus and taking its derivative.

\begin{align} y & = e-x^2e^x\\ y' & = -x^2e^x -2xe^x\\ & = -(x^2 + 2x)e^x\\ y' & = -x(x + 2)e^x\\ \end{align}

We get stationary points (minima, maxima, or points of inflexion) when $y'$ is zero. $e^x$ is not zero for finite $x$, so the only solutions for $y'=0$ are $x=0$ or $x=-2$. With some further analysis, it can be shown that there's a minimum at $x=-2$, with $y=e-4e^{-2}$, and a maximum at $x=0$, with $y=e$.

It is actually possible to invert $y =e-x^2e^x$. It's not possible using elementary functions, but it can be done using the Lambert W function (aka the omega function).

This function is defined to be the inverse function of $f(x)=xe^x$. In other words, if $y = xe^x$, then $x = W(y)$. As the Wikipedia article mentions, Lambert W is defined over the complex plane, and it's actually a family of functions because there is generally not a single inverse.

Here's how we use Lambert W to invert the given function.

\begin{align} y & = e - x^2 e^x\\ e - y & = x^2 e^x\\ \sqrt{e - y} & = x e^{\frac{x}{2}}\\ \frac{\sqrt{e - y}}{2} & = \frac{x}{2} e^{\frac{x}{2}}\\ W\left(\frac{\sqrt{e - y}}{2}\right) & = \frac{x}{2}\\ x & = 2 W\left(\frac{\sqrt{e - y}}{2}\right) \end{align}

When using this equation we need to choose which branch of the $W$ that we want, we also need to specify whether we want the positive or negative square root.

Many advanced mathematics libraries provide the Lambert W. Here's a short Python 3 demo using the mpmath library.

from mpmath import mp

# Use 50 decimal digits of precision
mp.dps = 50

# Print with 10 digits of precision
out_prec = 10

def func(x):
return mp.e - x * x * mp.exp(x)

def inv_func(y, sign, k):
return 2 * mp.lambertw(sign * mp.sqrt(mp.e - y) / 2, k=k)

r = mp.mpf('.1')
for i in range(-25, 15):
x = i * r
y = func(x)

# Determine which square root and branch of the Lambert W
# function we need to get back the x we started with
if x < -2:
sign, k = -1, -1
elif -2 <= x < 0:
sign, k = -1, 0
else:
sign, k = 1, 0

xx = inv_func(y, sign, k)
print(x, mp.nstr(y, n=out_prec), mp.nstr(xx, n=out_prec))


output

-2.5 2.205250587 -2.5
-2.4 2.195746418 -2.4
-2.3 2.187912545 -2.3
-2.2 2.181994542 -2.2
-2.1 2.17824898 -2.1
-2.0 2.176940696 -2.0
-1.9 2.178339113 -1.9
-1.8 2.182713431 -1.8
-1.7 2.190326444 -1.7
-1.6 2.201426742 -1.6
-1.5 2.216238968 -1.5
-1.4 2.234951779 -1.4
-1.3 2.257703098 -1.3
-1.2 2.284562163 -1.2
-1.1 2.315507817 -1.1
-1.0 2.350402387 -1.0
-0.9 2.388960404 -0.9
-0.8 2.430711291 -0.8
-0.7 2.47495503 -0.7
-0.6 2.520709639 -0.6
-0.5 2.566649164 -0.5
-0.4 2.611030621 -0.4
-0.3 2.651608189 -0.3
-0.2 2.685532598 -0.2
-0.1 2.709233454 -0.1
0.0 2.718281828 0.0
0.1 2.707230119 0.1
0.2 2.669425718 0.2
0.3 2.596794536 0.3
0.4 2.479589877 0.4
0.5 2.306101511 0.5
0.6 2.06231906 0.6
0.7 1.731543002 0.7
0.8 1.293935634 0.8
0.9 0.7260033084 0.9
1.0 0.0 1.0
1.1 -0.9167590605 1.1
1.2 -2.06268654 1.2
1.3 -3.48282954 1.3
1.4 -5.229910107 1.4


The number $e$ is not the same as the exponential function $e^x$.

$$e-x^2e^x=0$$

The mistake is after this line. You cannot cancel the exponentials from each term.

$$y(1) = e - (1)^2e^1 = e - e = 0.$$

• True, but you should probably add a little bit of explanation to this answer. Eg, "You've been given that the $x$ intercept is 1, so you just need to verify that fact by plugging $x=1$ into the equation and showing that $y$ is zero". – PM 2Ring Apr 24 '17 at 8:44
• @PM2Ring True - but I shall leave it given your excellent answer! – Mike Miller Apr 24 '17 at 12:58

If y=0 then; $e=x^2e^x$ therefor $x^2e^{x-1}=1$ since $e$ needs to be $1$ , $x-1=0$ hence $x=1.$

• It's typo sorry.@PM2Ring – Iti Shree Apr 24 '17 at 8:42
• Ok, but now you need to clarify the rest of your answer. "e can't be 0 for e to be 1" doesn't make much sense. – PM 2Ring Apr 24 '17 at 8:47
• ^I meant to say that for the function to be 1 therefore e needs to be 1, and hence x-1=0 since that's the only case. – Iti Shree Apr 24 '17 at 8:48
• But $e$ is $e$, not 1. ;) I expect that you mean "therefore $e^{x-1}$ needs to be 1". However, you're just asserting that $e^{x-1}$ needs to be 1, you haven't actually proved it. For all we know, there could be many solutions to $x^2 = e^{1-x}$. Fortunately, to answer the OP's question we don't need to worry about other solutions, we only need to verify that $x=1$ works. – PM 2Ring Apr 24 '17 at 8:58
• we don't need to find solution to $x^2=e^{1-x}$ but for $x^2e^{x-1}=1$ so can you find any other solution I'd be glad to know that. – Iti Shree Apr 24 '17 at 9:00

I don't see how this equation can be solved with ordinary algebraic methods. After taking the logarithm and re arranging you'll end up with the equivalent equation $$\ln{x} = \frac{1-x}{2},$$ no matter how you proceed, you can't get $x$ alone on ne side of the equation.

• It is possible to invert this equation, but you are correct that it cannot be done with the usual elementary functions. However, it can be done using the Lambert W function; see my answer for details. – PM 2Ring Apr 24 '17 at 11:23
• Interesting, thanks mate! :) – Parseval Apr 24 '17 at 12:04