# Combinatorics: Find the number of isosceles triangles with integer sides not exceeding $n$

Prove that the number of isosceles triangles with integer sides, no side exceeding n, is $\frac{1}{4}(3n^2+1)$ or $\frac{1}{4}(3n^2)$ according to whether n is odd or even.

My Working:
Let the sides be $x,y,x$. We know that the sum of 2 sides of a triangle is always greater than the third side. $$\therefore x>y/2$$ Next, it is given that no side can be greater than $n$. $$x\leq n$$

• Case 1: $x<y$ by taking an example I figured out the no. of possibilities is given by $\frac{n}{2}\cdot(\frac{n}{2}-1)=\frac{n^2-2n}{4}$
• Case 2: $y\leq x\leq n$ ...

Problem:
Firstly, I can't figure out a solution for case $2$. Moreover, I am not sure about whether what I have done for case $1$ is correct. It would be great if someone could help me find a solution for this question.

• In case $2$ why $x\leq 6$? – Gyanshu Jan 15 '17 at 5:22
• @Gyanshu sorry, that was the example I took so typed that by mistake. Made the correction. – Osheen Sachdev Jan 15 '17 at 5:23
• Guys it's been a day...anybody with an answer? – Osheen Sachdev Jan 16 '17 at 2:24

Denote the length of the two equal legs by $x$ and the length of the base by $y$. We then have to count the number of lattice points $(x,y)$ satisfying $$1\leq x\leq n,\qquad 1\leq y\leq\min\{2x-1,n\}\ .$$ To this end draw a figure. The lattice points in question are contained in a trapezoidal region with vertices $(1,1)$, $(n,1)$, $(n,n)$, and$\bigl({n+1\over2},n\bigr)$.
If $n$ is odd we can count these lattice points as follows: Taking them in vertical rows, starting at the left, we obtain $$N=1+3+5+\ldots +n+{n-1\over2}\cdot n=\left({n+1\over2}\right)^2+{n-1\over2}\cdot n={1\over4}(3n^2+1)\ .$$ I leave the case of even $n$ to you.