[Math] Adjacency Matrix of a Graph Length of Paths Proof

graph theorymatricesproof-writing

Let A be an adjacency matrix of a graph $G$. Prove that the $(i, j)^{th}$ entry of $A^2$ is the number of paths of length $2$ between vertex $i$ and vertex $j$.

*I know the adjacency matrix will be a square matrix.

I would appreciate any help explaining this problem and advice of where to begin this proof.

Best Answer

The number of paths of length $2$ from $u$ to $v$ is equal to the sum over $w\in V$ of all the ways to get from $u$ to $w$ multiplied by all the ways to get from $w$ to $v$, in one step. So it is the sum over $w\in G$ of $A_{u,w}A_{w,v}$. This is exactly $A^2_{uv}$.