So the question is :
Determine all pairs $(a, b)$ of positive integers satisfying $a^{b^2} = b^a$.
I tried it for 2 hours by different methods like taking it even, odd and by modulus method but cannot find any solution. Please help me in this question.
Just follow your nose; let $d:=\gcd(a,b)$ so that $a=du$ and $b=dv$ with $u$ and $v$ coprime. Then $$b^a=(dv)^{du}=((dv)^u)^d \qquad\text{ and }\qquad a^{b^2}=(du)^{d^2v^2}=((du)^{dv^2})^d,$$ from which it follows that $(dv)^u=(du)^{dv^2}$. Because $u$ and $v$ are coprime we either have $u=1$ or $v=1$.
If $u=1$ then $dv=d^{dv^2}$, and so $v=d^{dv^2-1}$ from which it quickly follows that also $v=d=1$ and hence $a=b=1$.
If $v=1$ then $d^u=(du)^d$ from which it follows that $u^d=d^{u-d}$, and in particular $u\geq d$. Let $c:=\gcd(d,u)$ so that $d=ce$ and $u=cw$ with $e$ and $w$ coprime and $w\geq e$. Then $$u^d=(cw)^{ce}=((cw)^e)^c \qquad\text{ and }\qquad d^{u-d}=(ce)^{cw-ce}=((ce)^{w-e})^c,$$ from which it follows that $(cw)^e=(ce)^{w-e}$. As $e$ and $w$ are coprime and $w\geq e$ it follows that $e=1$, so $$cw=c^{w-1},$$ and hence $w=c^{w-2}$, from which it quickly follows that $w\leq4$. We check these few cases: