Number of Dispersion Lines in A Square Dot Matrix

combinatoricselementary-number-theorygeometry

I want to find a formula to calculate the number of dispersion lines I can draw from any one corner of a square dot matrix of size $n \times n$.

By dispersion lines, I mean the lines that connect a particular point to all other points in a dot diagram. Here's a picture of what I mean :

Diagram

(That's an approximate diagram of what I mean; sorry for the crude diagram)
Here, the horizontal blue line on the top row (when considered a straight line) connects many dots to a single point (thus all those dots on the line are collinear), so when we count the number of dispersion lines, we have to count lines connecting many collinear points as one and we mustn't take the subunits into consideration.

So when we consider a square dot matrix, where the dots are arranged as a square, we can draw $3$ apparent dispersion lines, plus some more. What I would like to find is a formula to calculate the number of dispersion lines in square dot grids (or dot matrices).
What I have at hand is this one formula that I tried to formulate today:$$n^2 – (n + 2(n – 1)) + 3$$
The problem is that this formula isn't working for all values of $n$ (I mean, the number of dots in a column/row of the square dot matrix), and also I haven't been able to spend sufficient time to find the number of dispersion lines for $n > 5$. If asked for, I'll attach the numbers below.

Any help in formulating an accurate formula is appreciated. If such a formula exists, please do tell me.

Thanks in advance.

Best Answer

For $n=5$, the slopes of lines are in ascending order

$${\color{red}{0},\color{blue}{\frac{1}{4},\frac{1}{3},\frac{1}{2},\frac{2}{3},\frac{3}{4},}\color{red}{1},\color{green}{\frac{4}{3},\frac{3}{2},2,3,4,}\color{red}{\infty}}$$

where blue and green are reciprocal of each other (symmetry about principal diagonal), hence equal in number.

Observe green slopes can be grouped as $$ \color{green}{\underbrace{\frac{4}{3},\frac{4}{1}},\underbrace{\frac{3}{2},\frac{3}{1}},\underbrace{\frac{2}{1}}}$$

where numerators run from $2$ to $4$ and denominators are respectively coprime to numerators.

In general, this series runs from $i=2$ to $i=n-1$ and counts for all integers less than $i$ and coprime to it. We have Euler's totient function to count this, it is simply $\varphi(i)$.

Hence desired number of dispersion lines is $$f(n) = \color{red}{3} + \color{green}{2\sum_{i=2}^{n-1}} \color{green}{\varphi(i)} $$

We get following values

  • $n=2$, $f(n) = 3$
  • $n=3$, $f(n) = 5$
  • $n=4$, $f(n) = 9$
  • $n=5$, $f(n) = 13$
  • $n=6$, $f(n) = 21$
  • $n=7$, $f(n) = 25$

$f(n)$ satisfies the recurrence relation $$f(n) = f(n-1) + 2\varphi(n-1)$$

Related Question