I have to prove that
a^log n = n^log a
an example would be
2^log n = n^log2 = n
That isn't quite a true statement. It only works for a specific base:
$\displaystyle 2^{log_2(n)} = n^{log_2(2)} = n$
So your statement needs to read:
Prove: $\displaystyle a^{log_a(n)} = n^{log_a(a)}$
This isn't so much a proof as a definition: the logarithm and exponentiation operations are functional inverses.
What you need to do is show that each of these are equivalent to the same number.
We know that $\displaystyle n^{log_a(a)} = n^1 = n$
So what is $\displaystyle a^{log_a(n)}$? Well, call it x.
Then
$\displaystyle x = a^{log_a(n)}$
$\displaystyle log_a(x) = log_a \left ( a^ {log_a(n)} \right )$
$\displaystyle log_a(x) = log_a(n)$
Since log is a 1 to 1 function, we must have x = n. Thus
$\displaystyle a^{log_a(n)} = n = n^{log_a(a)}$
-Dan