two distinct vertices such that $ux \in E(G)$ and $vy \in E(G)$. Obviously, $P=u,x,y,v$ is a path of length three in $G$, see Figure \[potP\].

![\[potP\] Path $P$.](potP.eps)

We define $$p_3(G) = \sum_{e=xy \in E(G)}(\deg(x)-1)(\deg(y)-1).$$

One can notice that $p_3(G)$ is exactly the number of all the paths of length three in $G$. By a simple calculation we obtain

$$\begin{aligned}
p_3(G) & = & \sum_{e=xy \in E(G)} \Big[ \deg(x)\deg(y) - (\deg(x) + \deg(y))+ 1) \Big] \\
 & = & \sum_{e=xy \in E(G)}\deg(x)\deg(y) - \sum_{e=xy \in E(G)}(\deg(x) + \deg(y)) + \sum_{e=xy \in E(G)} 1 \\
 & = & M_2(G) - M_1(G) + |E(G)|,\end{aligned}$$

where the last equality follows by Equation .

However, for two vertices $u,v \in V(G)$ there may exists more than one path of length three between them. Suppose that there is some other path (distinct from $P$) $P'=u,a,b,v$ of length three between $u$ and $v$. Consider the following options:

-   $x \notin V(P')$ and $y \notin V(P')$:\
    In this case, $u$ and $v$ lie on a $6$-cycle $x,u,a,b,v,y,x$, see Figure \[sita\]. Moreover, this is the only $6$-cycle in $G$ containing $u$ and $v$ as diametrically opposite vertices (otherwise we have two distinct $6$-cycles with three edges in common).

    