I choose three random integer point in origin $|x|, |y|\leq r$. plane, what probability to this point creates a right triangle? I wont to choose three random integer point in origin $|x|\leq r, |y|\leq r$ at plane as $(a_{1},b_{1}),(a_{2},b_{2}),(a_{3},b_{3})$.
What the probability that this three point create a right triangle ( it is depend to r? what about isosceles triangle?
I think that its zero but I cant proof. Thank you.
 A: The following makes me think the number of right-angled triangles within the square $$[0,N]\times[0,N]\subset\mathbb{Z}^2$$
is some multiple of $N^4\log N$.  Since there are $O(N^6)$ triangles, this is a small proportion of them, as expected.  


*

*Take triangles whose short sides are aligned North-South and East-West.  There are $(N+1)^2$ choices for the position of the right-angle; $N$ choices for the end of the East-West side, and $N$ choices for the end of the North-South side, for $(N+1)^2N^2$, or roughly $N^4$ in all.  

*There is also triangles with short sides aligned NW/SE and NE/SW - along the diagonals.  I don't have a formula for them yet.  It should be about half the number from case 3, with $a=b=1$, because $(a,b)$ and $(b,a)$ give the same triangles.

*All other triangles have short sides aligned in directions $(a,b)$ and $(b,-a)$, where $a$ and $b$ have no common factor, and $a>b>0$.
A typical triangle has one side $m(a,b)$ for an integer $m$, and the other side $n(b,-a)$ for some integer $n$.
For now, I take $m>0,n>0$. Later, I consider symmetries of the square, which is equivalent to considering $m<0,n<0$ and $(b,a)$ instead of $(a,b)$.
The triangle has vertices 
$$(p,q),(p+ma,q+mb),(p+nb,q-na)$$
This fits within a rectangle of sides $(1+\min(ma,nb),1+mb+na)$, so the number of choices for $(p,q)$ is $(N-\min(nb,ma))(N-mb-na)$.
Sum for all values of $m$ and $n$ that give a positive number of triangles.  I turned the sum into an integral, and to leading order, I found 
$$\frac{\frac{(1-b/N)^4}{a^2b^2}+\frac{(a-b)^4}{a^4}+5}{24(a^2+b^2)}N^4$$
The numerator is between $5$ and $7$ because $a>b$.  There are eight symmetries of the square, so the total for this combination of $a$ and $b$ is eight times this value.  

*The total number of right-angled triangles is then of the order 
$$2N^4\sum_{(a,b)}\frac1{a^2+b^2}$$
If it were over all $0<b<a<N$, the sum by itself would be $O(\log N)$.  Since it is only for coprime $b$ and $a$, it may be less than that.  But the proportion of $(a,b)$ that are coprime is $6/\pi^2$, so that the sum may end up $$\frac{12}{\pi^2}N^4\log N$$

*When $a$ is prime, all $1\leq b\leq a-1$ are coprime to $a$.
$$\frac1{2a^2}<\frac1{a^2+b^2}<\frac1{a^2}\\
\frac1{3a}<\frac{a-1}{2a^2}<\sum_{b=1}^{a-1}\frac1{a^2+b^2}<\frac1a$$
So the sum, for just the prime values of $a$, is more than $\frac13\sum_{p<N}\frac1p$, which is known to be $O(\log\log N)$.  

*This gives a grand total 
$$\frac23N^4\log\log N<\text{Number of Right-angled Triangles}<2N^4\log N$$

A: My attempt:
If $r\in \mathbb{N}$ then there are $(2r+1)^{2}$ integer pair point and also there are $(2r+1)^{6}$ way to chose pair three integer number. So lets that $N(r)=(2r+1)^{6}$. We try to find all points that they create a right triangle. We denoted them by $N^{\prime}(r)$. For instance in this two figure, for $r=2,r=3$

$$N(2)=5^{6}, \ \ N^{\prime}(2)=?$$
$$N(2)=7^{6}, \ \ N^{\prime}(3)=?$$
We guess that $N^{\prime}(r)$ is a recursive sequence such as $N^{\prime}(r)=N^{\prime}(r-1)+h(r)$. But How about $h(r)$?. I don't know!!!
So $$P_{r}(Right \ \ triangle)=\dfrac{N^{\prime}(r)}{N(r)}=\dfrac{N^{\prime}(r-1)+h(r)}{N(r)}$$
And so:
$$‎\lim‎_{r‎\rightarrow ‎‎\infty‎}‎P_{r}( Right \ \ triangle )=\Huge{?!!?}$$
Thank you.
