Find the inverse of the $n\times n$ matrix whose entries are given by $a_{ij} = \max (i,j)$ The actual question on the past papers is "Let $n\ge 1$ be an integer and consider the $n\times n$ matrix $A$ whose entries are given by $a_{ij} = \max(i,j)$ for all $1\le i,j\le n$. Show that $A$ is invertible and find the inverse."
I have shown the matrix is invertible by finding the determinant to be $(-1)^{n-1}n$ which doesnt equal 0 for any value of $n$. Just wondering if someone can tell me how to find the inverse, I was thinking along the lines of using $A^{-1} = (1/\det(A))\mathrm{adj}(A)$ but I cant figure it out, thanks.

Let $\{e_1,\ldots,e_n\}$ be the standard basis, $e=\sum_ie_i$ be the all-one vector, $E=ee^T$ be the all-one matrix and $U$ be the upper triangular part of $E$. Then $A=(n+1)E-UU^T$. Apply Sherman-Morrison formula and simplify, we get $A^{-1}=\frac{n+1}n e_ne_n^T - U^{-T}U^{-1}$, i.e.
$$
A^{-1}=\pmatrix{
-1&1\\
1&-2&1\\
&1&\ddots&\ddots\\
&&\ddots&\ddots&\ddots\\
&&&\ddots&-2&1\\
&&&&1&\frac{1-n}n}.
$$
