Is there a way to work out $x$ if for example $a^x=b$ So say you had $5^x=25$ where $x$ is obviously $2$, how would you work $x$ out if the question wasn't obvious?
edit: What if the question was something like $a^x=-1$ (where $a$ is any number).
PS to all the maths elitists out there: Feel free to down vote, I just want to know how to do this.
 A: You would want to use a logarithmic function.
$a^x = b$, $x = \log_a(b)$
So in your case:
$5^x = 25$, $x = \log_5(25)=2$
A: We have for $a\neq0,1$ and $b>0$
$$a^x=b\iff \log a^x=\log b\iff x\log a=\log b\iff x=\frac{\log a}{\log b}$$
where $\log$ can be in any positive base $\neq 1$.
A: A bit of context :
For $a >0$, real, define the function 
$exp_a :\mathbb{R} \rightarrow \mathbb{R}$ by
$exp_a (x) = \exp (x\log a)$.
The image of this function is $(0,\infty)$.
Special cases:
$a^x = -1$.
$a$ cannot be a positive real (see above).
However, if $a=-1$, 
the equation $(-1)^n =-1$, has solutions for $n \in \mathbb{Z}$.
A: Your primary question has been answered.
To answer the additional question in your edited version, on how to solve $a^x = -1$, the short version is that you can't, at least in real numbers. Such an $x$ does not exist amongst the real numbers.
The long answer is that you can have $x$ taking on imaginary or complex values that can solve such an equation with a negative right hand side. But I won't go into details here because I think it might just be confusing for you.
