User:AugPi/sandbox

Problem: Given a square, $$m \times m$$ matrix $$M$$ whose diagonal elements are each equal to $$m$$ and whose non-diagonal elements are each equal to $$-1$$, calculate its determinant.

In symbols,
 * $$\Delta = \begin{vmatrix}m & -1 & -1 & \dots & -1 \\

-1 & m & -1 & \dots & -1 \\ -1 & -1 & m & \dots & -1 \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ -1 & -1 & -1 & \dots & m \end{vmatrix}$$ What is $$\Delta$$ as a function of $$m$$? A solution: The approach used here is to use Gaussian Elimination. Divide the top row by $$m$$:


 * $${\Delta \over m} = \begin{vmatrix}1 & -{1\over m} & -{1\over m} & \dots & -{1\over m} \\

-1 & m & -1 & \dots & -1 \\ -1 & -1 & m & \dots & -1 \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ -1 & -1 & -1 & \dots & m \end{vmatrix}$$ Anticipate addition of rows along the second column:
 * $$ m - {1\over m} = {m^2\over m} - {1\over m} = {m^2 - 1\over m}

= {(m+1)(m-1)\over m}$$ This should become the leading term of the second row.

Anticipate addition of rows along the third and latter columns:
 * $$ -{1\over m} - 1 = {-1 - m \over m} = - {(1+m)\over m}$$

This should become the trailing terms of the second row.

Add first row to second row and rows below it:


 * $${\Delta \over m} = \begin{vmatrix}

1 & -{1\over m} & -{1\over m} & \dots & -{1\over m} \\ 0 & {(m+1)(m-1)\over m} & - {(1+m)\over m} & \dots & - {(m+1)\over m} \\ 0 & - {(1+m)\over m} & {(m+1)(m-1)\over m} & \dots & - {(m+1)\over m} \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ 0 & - {(1+m)\over m} & - {(1+m)\over m} & \dots & {(m+1)(m-1)\over m} \end{vmatrix}$$ Divide second row by $$m - 1$$:


 * $${\Delta \over m(m-1)} = \begin{vmatrix}

1 & -{1\over m} & -{1\over m} & \dots & -{1\over m} \\ 0 & {(m+1)\over m} & -{(m+1)\over m(m-1)} & \dots & - {(m+1)\over m(m-1)} \\ 0 & - {(m+1)\over m} & {(m+1)(m-1)\over m} & \dots & - {(m+1)\over m} \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ 0 & - {(1+m)\over m} & - {(1+m)\over m} & \dots & {(m+1)(m-1)\over m} \end{vmatrix}$$ Anticipate addition along third column:
 * $${(m+1)(m-1)\over m} - {(m+1)\over m(m-1)}$$
 * $$\qquad = {(m+1)(m-1)^2 - (m+1)\over m(m-1)}$$
 * $$\qquad = {(m+1)[(m-1)^2 - 1] \over m(m-1)}$$
 * $$\qquad = {(m+1)[\cancel{(m-1+1)}(m-1-1)]\over \cancel{m}(m-1)}$$
 * $$\qquad = {(m+1)(m-2)\over (m-1)}$$

This should become the new leading element of the third row.

Anticipate addition along fourth and latter columns:
 * $$-{(m+1)\over m} - {(m+1)\over m(m-1)}$$
 * $$\qquad = -\Bigg[{(m+1)(m-1) + (m+1)\over m(m-1)}\Bigg]$$
 * $$\qquad = -{(m+1)\cancel{[m - 1 + 1]} \over \cancel{m}(m-1)}$$
 * $$\qquad = -{(m+1)\over(m-1)}$$

This should become the trailing elements of the third row. Add second row to rows below it:


 * $${\Delta \over m(m-1)} = \begin{vmatrix}

1 & -{1\over m} & -{1\over m} & \dots & \dots & -{1\over m} \\ 0 & {(m+1)\over m} & -{(1+m)\over m(m-1)} & \dots & \dots & - {(1+m)\over m(m-1)} \\ 0 & 0 & {(m+1)(m-2)\over(m-1)} & -{(m+1)\over(m-1)} & \dots & -{(m+1)\over(m-1)} \\ 0 & 0 & -{(m+1)\over(m-1)} & {(m+1)(m-2)\over(m-1)} & \dots & -{(m+1)\over(m-1)} \\ \vdots & \vdots & \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & -{(m+1)\over(m-1)} & -{(m+1)\over(m-1)} & \dots & {(m+1)(m-2)\over(m-1)} \end{vmatrix}$$ Divide third row by $$m - 2$$:


 * $${\Delta \over m(m-1)(m-2)} = \begin{vmatrix}

1 & -{1\over m} & -{1\over m} & \dots & \dots & -{1\over m} \\ 0 & {(m+1)\over m} & -{(1+m)\over m(m-1)} & \dots & \dots & - {(1+m)\over m(m-1)} \\ 0 & 0 & {(m+1)\over(m-1)} & -{(m+1)\over(m-1)(m-2)} & \dots & -{(m+1)\over(m-1)(m-2)} \\ 0 & 0 & -{(m+1)\over(m-1)} & {(m+1)(m-2)\over(m-1)} & \dots & -{(m+1)\over(m-1)} \\ \vdots & \vdots & \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & -{(m+1)\over(m-1)} & -{(m+1)\over(m-1)} & \dots & {(m+1)(m-2)\over(m-1)} \end{vmatrix}$$ Anticipate addition along fourth column:
 * $${(m+1)(m-2)\over(m-1)} - {(m+1)\over(m-1)(m-2)}$$
 * $$\qquad = {(m+1)(m-2)^2 - (m+1)\over(m-1)(m-2)}$$
 * $$\qquad = {(m+1)[(m-2)^2 - 1]\over(m-1)(m-2)}$$
 * $$\qquad = {(m+1)[\cancel{(m-1)}(m-3)]\over\cancel{(m-1)}(m-2)}$$
 * $$\qquad = {(m+1)(m-3)\over(m-2)}$$

This should become the leading element of the fourth row.

Anticipate addition along the fifth and latter columns:
 * $$-{(m+1)\over(m-1)} - {(m+1)\over (m-1)(m-2)}$$
 * $$\qquad = -{[(m+1)(m-2) + (m+1)]\over (m-1)(m-2)}$$
 * $$\qquad = -{(m+1)[m - 2 + 1]\over(m-1)(m-2)}$$
 * $$\qquad = -{(m+1)\cancel{(m-1)}\over\cancel{(m-1)}(m-2)}$$
 * $$\qquad = -{(m+1)\over(m-2)}$$

This should become the trailing elements of the fourth row. Add third row to the rows below it:
 * $${\Delta \over m(m-1)(m-2)} = \begin{vmatrix}

1 & -{1\over m} & -{1\over m} & \dots & \dots & \dots & -{1\over m} \\ 0 & {(m+1)\over m} & -{(1+m)\over m(m-1)} & \dots & \dots & \dots & - {(1+m)\over m(m-1)} \\ 0 & 0 & {(m+1)\over(m-1)} & -{(m+1)\over(m-1)(m-2)} & \dots & \dots & -{(m+1)\over(m-1)(m-2)} \\ 0 & 0 & 0 & {(m+1)(m-3)\over(m-2)} & -{(m+1)\over(m-2)} & \dots & -{(m+1)\over(m-2)} \\ 0 & 0 & 0 & -{(m+1)\over(m-2)} & {(m+1)(m-3)\over(m-2)} & \dots & -{(m+1)\over(m-2)} \\ \vdots & \vdots & \vdots & \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & 0 & -{(m+1)\over(m-2)} & -{(m+1)\over(m-2)} & \dots & {(m+1)(m-3)\over(m-2)} \end{vmatrix}$$

Divide the fourth row by $$m - 3$$:
 * $${\Delta \over m(m-1)(m-2)(m-3)} = \begin{vmatrix}

1 & -{1\over m} & -{1\over m} & \dots & \dots & \dots & -{1\over m} \\ 0 & {(m+1)\over m} & -{(1+m)\over m(m-1)} & \dots & \dots & \dots & - {(1+m)\over m(m-1)} \\ 0 & 0 & {(m+1)\over(m-1)} & -{(m+1)\over(m-1)(m-2)} & \dots & \dots & -{(m+1)\over(m-1)(m-2)} \\ 0 & 0 & 0 & {(m+1)\over(m-2)} & -{(m+1)\over(m-2)(m-3)} & \dots & -{(m+1)\over(m-2)(m-3)} \\ 0 & 0 & 0 & -{(m+1)\over(m-2)} & {(m+1)(m-3)\over(m-2)} & \dots & -{(m+1)\over(m-2)} \\ \vdots & \vdots & \vdots & \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & 0 & -{(m+1)\over(m-2)} & -{(m+1)\over(m-2)} & \dots & {(m+1)(m-3)\over(m-2)} \end{vmatrix}$$ Add fourth row to rows below it:


 * $${\Delta \over m(m-1)(m-2)(m-3)} = \begin{vmatrix}

1 & -{1\over m} & -{1\over m} & \dots & \dots & \dots & \dots & -{1\over m} \\ 0 & {(m+1)\over m} & -{(1+m)\over m(m-1)} & \dots & \dots & \dots & \dots & - {(1+m)\over m(m-1)} \\ 0 & 0 & {(m+1)\over(m-1)} & -{(m+1)\over(m-1)(m-2)} & \dots & \dots & \dots & -{(m+1)\over(m-1)(m-2)} \\ 0 & 0 & 0 & {(m+1)\over(m-2)} & -{(m+1)\over(m-2)(m-3)} & \dots & \dots & -{(m+1)\over(m-2)(m-3)} \\ 0 & 0 & 0 & 0 & {(m+1)(m-4)\over(m-3)} & -{(m+1)\over(m-3)} & \dots & -{(m+1)\over(m-3)} \\ 0 & 0 & 0 & 0 & -{(m+1)\over(m-3)} & {(m+1)(m-4)\over(m-3)} & \dots & -{(m+1)\over(m-3)} \\ \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & 0 & 0 & -{(m+1)\over(m-3)} & -{(m+1)\over(m-3)} & \dots & {(m+1)(m-4)\over(m-3)} \end{vmatrix}$$ For purposes of calculating a determinant, the non-diagonal elements of an upper-triangular matrix do not matter. By induction the equation ends up looking thus:


 * $${\Delta \over m(m-1)(m-2)(m-3)...(2)(1)} = \begin{vmatrix} {(m+1)\over (m+1)} & -{1\over m} & -{1\over m} & \dots & \dots & \dots & \dots & \dots & -{1\over m} \\ 0 & {(m+1)\over m} & -{(1+m)\over m(m-1)} & \dots & \dots & \dots & \dots & \dots &  - {(1+m)\over m(m-1)} \\ 0 & 0 & {(m+1)\over(m-1)} & -{(m+1)\over(m-1)(m-2)} & \dots & \dots & \dots & \dots & -{(m+1)\over(m-1)(m-2)} \\ 0 & 0 & 0 & {(m+1)\over(m-2)} & -{(m+1)\over(m-2)(m-3)} & \dots & \dots & \dots & -{(m+1)\over(m-2)(m-3)} \\ 0 & 0 & 0 & 0 & {(m+1)\over(m-3)} & -{(m+1)\over(m-3)(m-4)} & \dots & \dots & -{(m+1)\over(m-3)(m-4)} \\ 0 & 0 & 0 & 0 & 0 & {(m+1)\over(m-4)} & -{(m+1)\over(m-4)(m-5)} & \dots & -{(m+1)\over(m-4)(m-5)} \\ 0 & 0 & 0 & 0 & 0 & 0 & {(m+1)\over(m-5)} & \dots & -{(m+1)\over(m-5)(m-6)} \\ \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & 0 & 0 & 0 & 0 & \dots & 0 & {(m+1)\over 2} \end{vmatrix}$$

The determinant of the upper triangular matrix equals the product of its diagonal elements:
 * $${\Delta \over m(m-1)(m-2)...(1)} = {(m+1)^m\over (m+1)(m)(m-1)(m-2)...(3)(2)}$$


 * $$\Delta = {(m+1)^m \over (m+1)} = (m+1)^{m-1}$$