5. From the 16 vertices of a $3 \times 3$ grid composed of nine unit squares, three vertices are chosen at random. The probability that these three points form a right-angled triangle is $\qquad$
5. $\frac{5}{14}$.

If the right-angle sides are on the grid lines, then the right-angle vertex has 16 ways to be chosen, and the other two vertices each have 3 ways. Therefore, there are 144 different right-angled triangles with right-angle sides on the grid lines.

Next, calculate the number of right-angled triangles where the right-angle sides are not on the grid lines.
(1) In a $1 \times 2$ rectangle, there are two right-angled triangles with side lengths $(\sqrt{2}, \sqrt{2}, 2)$. There are six $1 \times 2$ rectangles horizontally and six vertically, making a total of $2 \times 12 = 24$.
(2) In a $2 \times 3$ rectangle, there are four right-angled triangles with side lengths $(\sqrt{5}, \sqrt{5}, \sqrt{10})$ and four right-angled triangles with side lengths $(\sqrt{2}, 2\sqrt{2}, \sqrt{10})$. There are two $2 \times 3$ rectangles horizontally and two vertically, making a total of $(4+4) \times 4 = 32$.
Thus, the required probability is
$$
P=\frac{144+24+32}{\mathrm{C}_{16}^{3}}=\frac{200}{40 \times 14}=\frac{5}{14} \text {. }
$$