Pattern rule of a lower diagonal region of a matrix

38 Views Asked by At

I have a vector of numbers. Each number refers to the number of elements in the lower part of a square matrix, excluding the diagonal. For example, a 2-by-2 matrix would yield the number 1, a 3-by-3 matrix would yield the number 3.

So, the pattern is {1, 3, 6, 10, 15, 21, 28, ...}. How could you back-calculate from this number the length of one side of the square matrix?

Note: I can't just calculate with a sequence, because there are missing elements, e.g. there wouldn't be a matrix with the square edge length of 450.

1

There are 1 best solutions below

0
On BEST ANSWER

The number of elements along and above the diagonal of a matrix of size $n \times n$ is given by

$$ \frac{n(n+1)}{2} $$

So, if $d$ is the number of elements below the diagonal you want to solve

$$ \begin{align} n^2 - \frac{n(n+1)}{2} &= d\\ \implies n^2 - n -2d &= 0\\ \end{align} $$

$$ \implies n = \frac{1 \pm \sqrt{1 + 8d}}{2} $$

You will just want the positive root so

$$ n = \frac{1 + \sqrt{1 + 8d}}{2} $$