# Behavior of $f(x)=(-1)^x$

For what $$x$$ is $$f(x)=(-1)^x$$ a real number, and when is it a complex number?

When I graph it online, the graph glitches out and has points all over the place.

• Consider $f(x) = e^{i \pi x}$ Feb 3, 2019 at 4:44
• Remember, $(-1) = e^{i \pi}$ Feb 3, 2019 at 4:45
• The first thing one should ask, maybe, is the definition of the expression $(-1)^x$.
– user587192
Feb 3, 2019 at 13:44

This is the same as $$\exp(x\pi i)=\cos(x\pi)+i\sin(x\pi)$$. For it to be real, $$\sin(x\pi)=0$$, i.e. $$x$$ is an integer.

• That does make sense. The only thing $(-1)^\frac{2}{3}=((-1)^2)^\frac{1}{3}=1$, where is the fallacy in that equation? Feb 3, 2019 at 5:14
• @Simplex1 when dealing with complex numbers, numbers can have more than $1$ root. I gave the formula for the principal root, but there are more, given by integer multiples of the argument. Your equation neglects that, and only looks at the real one. Feb 3, 2019 at 5:17

If you recall that $$(-1) = e^{i \pi}$$ then $$f(x)= e^{i \pi x}$$ Which is then $$\cos(\pi x) +i\sin(\pi x)$$

Does this help at all?

When $$-1$$ is raised to power of $$x$$ the complex number so formed has a real part $$\cos \pi x$$ and imaginary part $$\sin \pi x.$$ This can be found using Euler formula $$e^{i \pi}=-1$$. The two parts are graphed below .. with each part having a period or wave length $$\lambda=2,$$ the roots are at $$x=..,-2,-1,0,1,2,...$$ etc.

Real part vanishes for all integer values of $$x$$ as is obvious from graph and direct check by plugin.

The $$f(x)$$ thus is always complex for all real values of $$x$$

Again for complex $$x= a+ib ,\, f(x)$$ is complex.

• This is a good answer, but while I agree the phrasing in the question is vague, I think "complex" is supposed to mean "complex and not real" in the question. So even though it's correct that $f(x)$ is always complex, I think this doesn't directly answer the OP's question. Feb 3, 2019 at 5:50
• I understood OP question as asking: [when is $f(x)$ real and when is it complex?] Feb 3, 2019 at 7:13