Number of lines determined given a set of points Consider the following set of points in the $x-y$ plane:
$$A=\{ (a,b)|a,b \in \mathbb{Z} \ and \ |a|+|b|\le 2\}$$
How to find the number of straight lines which pass through at least 2 points in $A$?
One line is determined by 2 distinct points. To find the number of lines one is to choose any 2 points and find the possible combinations. The counting is easy if any 3 points are non-collinear, or only small number of points are collinear and the collinear points are non-collinear to the others. But there are a total of 13 points in the set, which gets complicated(at least for me) when there are different subsets of $A$ which consist of collinear points. Considering separate cases don't help much either. 
Is there any way to count the number of lines determined by the points in the set above? And how should one find the number of lines determined when given larger size of set of points? Can anyone provide any hint and guidance? Thanks in advance.
The answer is 40 lines.

Let's consider the following grid (which represents your set $A$):
         *

     *   *   *

*    *   *   *   *

     *   *   *

         *

Now note we have $3$ vertical lines, $3$ horizontal lines, $5$ lines with slope $1$ and $5$ lines with slope $-1$. Together this is $16$ lines. Lets now iterate through other slopes. Note that if we can find the line for a positive slope, then there will also be the line for the negative slope because of symmetry. So to count our lines with positive slope lets start with the smallest possible slope and work upwards. To begin we have $2$ lines with slope $1 / 3$, next $4$ lines with slope $1 / 2$. Now if you notice theres another symmetry that allows us to deduce that there are $4$ lines with slope $2$ and $2$ lines with slope $3$. Adding these up we get $12$ lines, and then we get our $12$ negative slope lines and our originally $16$ lines. All together this is $40$ lines.
Hope this helps! Symmetry was the key factor to make this easy for me!
