Is the "Its transpose is its inverse" definition of an orthogonal matrix equivalent to the "It preserves the dot product" definition? A long time ago, I was taught that a real $n\times n$ matrix $A$ is called orthogonal if $AA^t=I$. But recently I learned from a DG book that $A$ is said to be orthogonal if it preserves the dot product:
$$(Ax)\cdot(Ay)=x\cdot y\quad\text{for all }x,y\in\mathbb{R}^n.$$
Are these two definitions equivalent? It is easy to see that the former implies the latter:
$$(Ax)\cdot(Ay)=(Ay)^t(Ax)=(y^t A^t)(Ax)=y^t x=x\cdot y$$
But I have a hard time going from the latter to the former. Is it possible? Thank you for your time.

Suppose $Ax\cdot Ay=x\cdot y$ for all $y$.
Recall that  $Ax\cdot Ay=A^{T}Ax\cdot y$.
So $(A^{T}Ax-x)\cdot y=0$.
Put $y=A^{T}Ax-x$ to see that $A^{T}Ax=x \ \forall x$.
