I was reading about Legendres symbol (number theory) and encountered the following equality:
I don't understand how they got $$\left(\frac 3p \right) = (-1)^{\frac{p-1}{2}\frac{3-1}{2}}\left(\frac{p-1}{3}\right) \tag{underlined with red}$$ I thought $p-1$ in RHS should have been $p$ instead but saw the same thing in the other part of the section:
$\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad$
I tried to show that the last image illustrates the true identity as follows: $$\left(\frac{p-1}{5}\right) = \left(\frac{2\cdot\frac{p-1}{2}}{5}\right) = \left(\frac{2}{5}\right)\left(\frac{\frac{p-1}{2}}{5}\right) =\left(\frac{\frac{p-1}{2}}{5}\right) $$
But I can't show that the last expression is equal to $(5/p)$.
Is there anything I missed while learning the theory behind this symbol?

You are right, that should have been $p$ instead of $p-1$. It is certainly false in general that $$\left( \frac 3p\right) = (-1)^{(p-1)(3-1)/4} \left( \frac {p-1}3\right) \,.$$ For example, when $p = 5$ the LHS is $-1$ and the RHS is $1 \cdot 1$.
Maybe the author got caught up in writing all the $p-1$'s in the exponents.