I'm trying to understand a "subproof" of the divisor Master Theorem (Cormen et al., Introduction to Algorithms, page 99), and in some point they state:
$$\Large a^{\log_b n} = n^{\log_b a}$$
where $a\geq 1$, $b > 1$ and $n = b^i$, for some $i$. That is, $n \in \{1, b, b^2, ...\}$
I would appreciate a simple explanation of this equality (just OK for a CS undergraduate).
Let us start here:
$$\log_b(a)\log_b(n)=\log_b(n)\log_b(a)$$
$$b^{\left(\log_b(a)\log_b(n)=\log_b(n)\log_b(a)\right)}$$
$$b^{\log_b(a)\log_b(n)}=b^{\log_b(n)\log_b(a)}$$
$$\left(b^{\log_b(a)}\right)^{\log_b(n)}=\left(b^{\log_b(n)}\right)^{\log_b(a)}$$
Recall that $x^{\log_x(y)}=y$, so
$$a^{\log_b(n)}=n^{\log_b(a)}$$