How many triangles in picture How many triangles in this picture:

I know that I can just count the triangles to solve this specific problem. I would be interested to know if there is a systematic approach to doing this that can be generalized to larger diagrams of the same type.
 A: They can be counted quite easily by systematic brute force.
All of the triangles are isosceles right triangles; I’ll call the vertex opposite the hypotenuse the peak of the triangle. There are two kinds of triangles:


*

*triangles whose hypotenuse lies along one side of the square;  

*triangles whose legs both lie along sides of the square and whose peaks are at the corners of the square.


The triangles of the second type are easy to count: each corner is the peak of $4$ triangles, so there are $4\cdot4=16$ such triangles.
The triangles of the first type are almost as easy to count. I’ll count those whose hypotenuses lie along the bottom edge of the square and then multiply that by $4$. Such a triangle must have a hypotenuse of length $1,2,3$, or $4$. There $4$ with hypotenuse of length $1$, $3$ with hypotenuse of length $2$, $2$ with hypotenuse of length $3$, and one with hypotenuse of length $4$, for a total of $10$ triangles whose hyponenuses lie along the base of the square. Multiply by $4$ to account for all $4$ sides, and you get $40$ triangles of the second type and $40+16=56$ triangles altogether.
Added: This approach generalizes quite nicely to larger squares: the corresponding diagram with a square of side $n$ will have $4n$ triangles of the first type and $$4\sum_{k=1}^nk=4\cdot\frac12n(n+1)=2n(n+1)$$
of the second type, for a total of $2n^2+6n=2n(n+3)$ triangles.
A: I know there's already an excellent answer from Brian M. Scott... Buuuuut...
Here's a visual supplement to the aforementioned systematic brute force.

