In the given figure, we have 16 points forming a square grid and two lines, $r$ and $s$, which are perpendicular to each other.

![](https://cdn.mathpix.com/cropped/2024_05_01_30c9a294a58a6e4b8190g-024.jpg?height=443&width=446&top_left_y=652&top_left_x=842)

(a) How many squares can we construct such that their vertices belong to the grid, but none of their sides are parallel to either line $r$ or line $s$?

(b) How many right-angled isosceles triangles can we construct such that their vertices belong to the grid, but none of their sides are parallel to either line $r$ or line $s$?
(a) The only squares that do not have any of their sides parallel to line $r$ or line $s$ are those of type 1 and type 2 (see figures).

![](https://cdn.mathpix.com/cropped/2024_05_01_30c9a294a58a6e4b8190g-085.jpg?height=488&width=502&top_left_y=470&top_left_x=914)

Thus, there are a total of six squares, four of type 1 and two of type 2.

(b) Suppose the vertical or horizontal distance between two adjacent points on the grid is equal to one unit. The total of these triangles is sixteen, each with legs equal to $\sqrt{5}$ units and a hypotenuse of $\sqrt{10}$ units. Indeed, each of the squares of type 2, as seen in (a), gives us four triangles, by dividing along each of the two diagonals, thus obtaining eight triangles. The remaining eight triangles are obtained through a single horizontal or vertical translation of each of the previous ones. In the figure, we illustrate the only possible translation of one of the four triangles obtained from a square of type 2.

![](https://cdn.mathpix.com/cropped/2024_05_01_30c9a294a58a6e4b8190g-085.jpg?height=417&width=434&top_left_y=1505&top_left_x=937)