In the book by Lardner on Algebraic Geometry, on page 220, there is given derivation for finding distance between points on oblique axes. Have confusion in the part where the author states:
$AP^2=AQ^2+PQ^2+2(AQ.QN)$
I am unable to understand:
(i) why area of rectangle with sides AQ, QN is taken up when no rectangle is there as such; instead there is straight line AN,
(ii) why need for this addition arose to the sum of $AQ^2 +PQ^2$.

That is just the cosine rule.
\begin{align} AP^2 &= AQ^2 + PQ^2 -2 (AQ)(PQ)\cos \angle AQP \\ &= AQ^2 + PQ^2 + 2(AQ) (PQ) (-\cos \angle AQP) \\ &= AQ^2 + PQ^2 +2(AQ)(PQ)\cos \angle PQN \\ &= AQ^2+PQ^2+2(AQ)(QN) \end{align}