The above animation shows two ways to understand the dot product of two vectors \(\vec v\) and \(\vec w\):
Starting with either one of these geometric definitions, it's possible to derive the usual formulas $$ (a\hat i + b\hat j) \cdot (x\hat i + y\hat j) = ax+by $$ and $$ \vec v \cdot \vec w = |\vec v| |\vec w| \cos(\alpha), $$ where \(a,b,x,y \in \mathbb{R}\) are components of vectors in directions of \(x\) and \(y\) axises, and \(\alpha \in \mathbb{R}\) is the angle between \(\vec v\) and \(\vec w\).
Applying these formulas with \(\vec v = \vec w = a\hat i +b \hat j=x\hat i + y\hat j\) leads to a proof of the Pythagorean theorem.