# Find determinant of the matrix NxN

We are given matrix $M_{n,n}$, where
$m_{ij} = \begin{cases} a_i \cdot a_j,\ \mbox{if}\ i \ne j \\a_i^2+k,\ \mbox{if}\ i=j \end{cases}$

Hence, M gotta look like that:
$\left( \begin{array}_ a_1^2+k & a_1a_2 & ... & a_1a_n \\ a_2a_1 & a_2^2+k & ... & a_2a_n \\ ... &... &... & ... &\\ a_na_1 & a_na_2 & ... & a_n^2+k \end{array} \right)$

I would like to find the determinant. Any suggestion?

• What have you tried? What is the difficulty here? I don't think you can find a closed formula for such a general case. – 7raiden7 Mar 7 '14 at 12:23
• @7raiden7 I just found this statement, that determinant of triangular matrix is equal to product of diagonal elements. I am going to try Gaussian elimination on that matrix to get at least diagonal values. It doesn't look like easy task because of generality. I will write here when get any progress. – wf34 Mar 7 '14 at 12:28
• Yes, but your matrix is not lower/upper triangular. Indeed, it is symmetric, and the determinant is not (unfortunately) just the product of diagonal elements. – 7raiden7 Mar 7 '14 at 12:31
• @7raiden7 I guess we have a little misunderstanding. As I stated in my comment earlier, I believe it would be possible to bring this matrix to triangular shape using Gaussian elimination method. – wf34 Mar 7 '14 at 12:36

If you replace $k$ with $-\lambda$, the determinant you are looking for is the characteristic polynomial of $$(a_i\cdot a_j)_{ij}=B^TB,\ \ \ \text{ where }B=[a_1\ a_2\cdots a_n].$$ Now note that $BB^T=a_1^2+\cdots +a_n^2$ has rank one, and so $B^TB$ has rank one too. This means that it has one nonzero eigenvalue and then zero with multiplicity $n-1$. The nonzero eigenvalue agrees with that of $BB^T$ (or we can also notice that it has to agree with the trace of $B^TB$).
Thus, the characteristic polynomial of $B^TB$ is $(-\lambda)^{n-1}(a_1^2+\cdots +a_n^2-\lambda)$. We conclude that $$\det A=k^{n-1}(a_1^2+\cdots +a_n^2+k).$$ Note also that this gives us more information, in the sense the eigenvalues of $A$ are precisely $k$ with multiplicy $n-1$ and $k+a_1^2+\cdots+a_n^2$ with multiplicity $1$.
• Did I take it wrong, or $B^TB$ and $BB^T$ mixed up here? I believe, $B^TB$ couldn't be equal to $a_1^2 + ... + a_n^2$, since $B^T$ has size Nx1, and size of $B$ is 1xN, hence $B^TB$ would result with NxN matrix, isn't? And $BB^T$ should give above-mentioned one-element matrix. – wf34 Mar 8 '14 at 19:20