Graham's formula for determinant of distance matrix of a tree The following is a proof of Graham's formula for the determinant of the distance matrix of a tree in the book Graphs and Matrices by R.B. Bapat.

I am not able to come up with the final matrix $D_2$ as in the proof. The matrix I am able to come up with, by following the row column operation as given in the proof is:
$\begin{bmatrix} 0&1&1&...&1\\ 1&-2&1&...&1\\ 1&1&-2&...&1\\ .&.&.&...&.\\ 1&1&1&...&-2\end{bmatrix}$
Thanks in advance!
 A: Here are the first two steps of the row/column reduction, carefully done.
First, assume that $v_n$ is a leaf of $T$ adjacent to $v_{n-1}$. Then the matrix looks like
$$\begin{bmatrix}
    {} & {} & \cdots & d_1 & d_1 + 1 \\
    {} & {} & \cdots & d_2 & d_2 + 1 \\
    \vdots & \vdots & \ddots & \vdots & \vdots \\
    d_1 & d_2 & \cdots & 0 & 1 \\
    d_1+1 & d_2+1 & \cdots & 1 & 0
\end{bmatrix}$$
where $d_1, d_2, \dots, d_{n-2}$ are the distances from $v_{n-1}$ to $v_1, v_2, \dots, v_{n-2}$. Subtracting the next-to-last row from the last, then subtracting the next-to-last column from the last, gives us
$$\begin{bmatrix}
    {} & {} & \cdots & d_1 & 1 \\
    {} & {} & \cdots & d_2 & 1 \\
    \vdots & \vdots & \ddots & \vdots & \vdots \\
    d_1 & d_2 & \cdots & 0 & 1 \\
    1 & 1 & \cdots & 1 & -2
\end{bmatrix}.$$
Now permute the first $n-1$ vertices (and the corresponding rows/columns of the matrix) so that $v_{n-1}$ is a leaf of $T - v_n$ adjacent to $v_{n-2}$. Then the matrix looks like
$$\begin{bmatrix}
    {} & {} & \cdots & d_1 & d_1 + 1 & 1\\
    {} & {} & \cdots & d_2 & d_2 + 1 & 1 \\
    \vdots & \vdots & \ddots & \vdots & \vdots & \vdots \\
    d_1 & d_2 & \cdots & 0 & 1 & 1\\
    d_1+1 & d_2+1 & \cdots & 1 & 0 & 1 \\
    1 & 1 & \cdots & 1 & 1 &-2
\end{bmatrix}$$
where this time $d_1, d_2, \dots, d_{n-3}$ are the distances from $v_{n-2}$ to $v_1, v_2, \dots, v_{n-3}$. 
Again, we do the same reduction: subtract row $n-2$ from row $n-1$, then subtract column $n-2$ from column $n-1$. We get: 
$$\begin{bmatrix}
    {} & {} & \cdots & d_1 & 1 & 1\\
    {} & {} & \cdots & d_2 & 1 & 1 \\
    \vdots & \vdots & \ddots & \vdots & \vdots & \vdots \\
    d_1 & d_2 & \cdots & 0 & 1 & 1\\
    1 & 1 & \cdots & 1 & -2 & 0 \\
    1 & 1 & \cdots & 1 & 0 &-2
\end{bmatrix}$$
and here the key thing to notice are the two zeroes that appeared next to the bottom right corner: they are the differences of two of the $1$'s that appeared in the previous step. (This, I think, is the part you missed.)
As we do more steps, the $1$'s we create will continue turning into zeroes, until we get a matrix of the form given by $D_2$.
