# How can I plot $y^x$?

How can I plot $y^x$? To keep things simple and to not have another $z$ variable on the other end of the equation, let's assume $y^x=10$. As long as that value is not $0$, the curve we get should look about the same.

The problem arises when $x$ is negative. The thing is, when $x$ is an odd, then y can only be a positive number. However, when $x$ is even, y can be either positive or negative. Therefore, if you look at the $x$ negative side of the graph, you would be able to mark a point whenever $x$ is even, but there would be no point when it is odd. So how could you graph such a thing? I simply have no idea what happens between two negative odd numbers (e.g. how does the curve behave between $-1$ and $-3$?)

As always, I tried WolframAlpha, and even it has trouble graphing the thing! Here is what it ends up with.

• Do you want to plot the real and imaginary parts then? – dustin Nov 16 '14 at 3:30
• Well, I was thinking only about the real parts... Is there an imaginary part? When x is a negative even number, you would get a negative positive root. So, for example, when x = -2, then y = -√10. – Rodrigo Nov 16 '14 at 3:38
• Does it matter if I plot it in Matlab or must it be in Mathematica? – dustin Nov 16 '14 at 3:39
• I don't know... I used Wolfram, and it goes crazy trying to solve it. – Rodrigo Nov 16 '14 at 3:42
• Do you want 2d plot? – dustin Nov 16 '14 at 3:49

In Matlab:

>> x=linspace(-10,10,5000);
>> y=linspace(-10,10,5000);
>> t=y.^x-10;
>> plot(x,real(t))
>> plot(x,imag(t))


Real:

Imaginary:

Mathematica 3D plots:

Plot3D[Re[y^x - 10], {x, -10, 10}, {y, -10, 10}]
Plot3D[Im[y^x - 10], {x, -10, 10}, {y, -10, 10}]


Real:

Imaginary:

2D Contour plots:

ContourPlot[Re[y^x - 10], {x, -10, 10}, {y, -10, 10}]
ContourPlot[Im[y^x - 10], {x, -10, 10}, {y, -10, 10}]


Real:

Imaginary:

• Wow! I can barely make any sense out of all this, I have to study many more years to get there... I can't understand, however, how, in the real 2D graph, y is increasing as x get's bigger. Shouldn't y equals the x-eth roots of 10? – Rodrigo Nov 16 '14 at 4:08
• @Rodrigo What you see as the y axis is really the z axis. You are looking at x vs z. – dustin Nov 16 '14 at 4:12

$y^x = 10$ is equivalent to $e^{x\ln y}=10$, i.e. $\ln y=\frac{\ln 10}{x}$, or (again) $y=e^{\frac{\ln 10}{x}}$ (in particular, from the very beginning observe that we must have $y > 0$ for the expression to be defined without ambiguity). The latter form can be easily plotted, e.g. via Mathematica.

• Doesn't that just equal $\sqrt[x]{10}$? That can be obtained directly from the first equation, actually, by taking $x$-eth roots. – Akiva Weinberger Nov 16 '14 at 3:54
• Indeed -- the main point of going to the definition of $y^x$ (which for $x$ real goes through the logarithm) is to highlight what the condition on $y$ is. – Clement C. Nov 16 '14 at 3:55