I can find the answer (correct?) to the following $$ \frac{a}{b}+\frac{b}{a}>2 \tag 1 $$ However according to the book my solution is "wrong". Why is that? Which lines are wrong? \begin{align} a^2+b^2&>2ab\tag 2\\ a^2-ab&>ab-b^2\tag 3\\ a(a-b)&>b(a-b)\tag 4\\ a&>b \tag 5 \end{align}
I also tried the following and found the same answer: \begin{align} a^2+b^2-2ab&>0\tag 6\\ (a-b)^2&>0\tag 7\\ a>b \tag 8 \end{align}
What is the difference between the solutions?
For ab<0 the given inequality is not true then assume $a,b>0$.
Note that from line $(4)$
$$a(a-b)>b(a-b)$$
dividing both sides by $a-b\neq 0$ we obtain
$a>b$ when $a-b>0$
$a<b$ when $a-b<0$
that is $a\neq b$ which is the same result we obtain from line $(6)$, indeed
$$a^2+b^2>2ab \iff a^2+b^2-2ab>0\iff(a-b)^2>0$$
wich is true for $a-b\neq 0 \iff a\neq b$,
Therefore your derivations are wrong in line $(5)$ and line $(8)$ which should be $a\neq b$.
As an alternative by Rearrangement inequality for $(a,b)$ and $(1/a,1/b)$ we have that
$$\frac{a}{b}+\frac{b}{a}\ge \frac{a}{a}+\frac{b}{b}=2$$
and equality holds if and only if $a=b$ therefore the given inequality holds for $a\neq b$.