Example 10 Let the set $S=\{1,2, \cdots, 50\}, X$ be any subset of $S$, $|X|=n$. Find the smallest positive integer $n$, such that the set $X$ must contain three numbers that are the lengths of the three sides of a right-angled triangle.
Let the three sides of a right-angled triangle be $x, y, z$, with $x^{2}+y^{2}=z^{2}$. The positive integer solutions can be expressed as:
$$x=k\left(a^{2}-b^{2}\right), y=2 k a b, z=k\left(a^{2}+b^{2}\right)$$

where $k, a, b \in \mathbf{N}^{*}$ and $(a, b)=1, a>b$.
First, one of $x, y, z$ must be a multiple of 5. Otherwise, if $a, b, c$ are not multiples of 5, then $a, b, c$ are numbers of the form $5 m \pm 1, 5 m \pm 2$ $(m \in \mathbf{N})$, so $a^{2} \equiv \pm 1(\bmod 5)$, $b^{2} \equiv \pm 1(\bmod 5)$, $c^{2} \equiv \pm 1(\bmod 5)$, and $c^{2}=a^{2}+b^{2} \equiv 0$ or $\pm 2$, which is a contradiction!

Let the set $A=\{S$ of all numbers coprime with 5 $\}$, then $\operatorname{Card} A=40$. If 10, 15, 25, 40, 45 are used as the lengths of one side of a right-angled triangle, then by (1) we can find the corresponding sides in $A$ to form the following right-angled triangles: $(10,8,6),(26,24,10),(15,12,9),(17,15,8),(39, 36,15),(25,24,7),(40,32,24),(41,40,9),(42,27,36)$. In addition, there are no numbers in $A$ that can form the three sides of a right-angled triangle with 10, 15, 25, 40, 45.

Let $M=A \cup\{10,15,25,40,45\} \backslash\{8,9,24,36\}$, then $\operatorname{Card} M=41$.
From the above, we know that no three numbers in $A$ can form a right-angled triangle. Since $M$ does not contain 8, 9, 24, 36, 10, 15, 25, 40, 45 cannot find numbers in $M$ to form the three sides of a right-angled triangle, i.e., no three numbers in $M$ can form the three sides of a right-angled triangle, so $n \geqslant 42$.

Furthermore, by the integer solutions in (1), we can form the set: $B=\{\underline{3,4,5}, \underline{17,15,8}, \underline{29,21,20}, \underline{25}, 24,7, \underline{34}, 16,30,37,35,12, \underline{50}, 48,14,41,40,9,45,36,27\}$, where the three numbers underlined can form the sides of a right-angled triangle, $\operatorname{Card} B=27$.
The number of elements in $S \backslash B$ is $50-27=23$. If 42 numbers are chosen from $S$, since $42-23=19$, the 42 chosen numbers must contain 19 numbers from $B$, so at least one set of three numbers underlined in $B$ will be among the 42 chosen numbers, i.e., any 42 chosen numbers will contain at least three numbers that can form the sides of a right-angled triangle. Therefore, the minimum value of $n$ is 42.