Example 1: In a class, the number of students who excel in mathematics, physics, and chemistry are 30, 28, and 25, respectively. The number of students who excel in both mathematics and physics, both physics and chemistry, and both mathematics and chemistry are 20, 16, and 17, respectively. The number of students who excel in all three subjects is 10. How many students excel in at least one of mathematics and physics? How many students excel in at least one of the three subjects?
Let $A_{1}, A_{2}, A_{3}$ represent the sets of students who excel in mathematics, physics, and chemistry, respectively. According to the problem,
$$
\begin{array}{c}
\left|A_{1}\right|=30,\left|A_{2}\right|=28,\left|A_{3}\right|=25, \\
\left|A_{1} \cap A_{2}\right|=20,\left|A_{2} \cap A_{3}\right|=16,\left|A_{3} \cap A_{1}\right|=17, \\
\left|A_{1} \cap A_{2} \cap A_{3}\right|=10 .
\end{array}
$$

By the principle of inclusion-exclusion,
$$
\left|A_{1} \cup A_{2}\right|=\left|A_{1}\right|+\left|A_{2}\right|-\left|A_{1} \cap A_{2}\right|=30+28-20=38 \text {, }
$$

which means the number of students who excel in at least one of mathematics and physics is 38.
Similarly, by the principle of inclusion-exclusion,
$$
\begin{aligned}
& \left|A_{1} \cup A_{2} \cup A_{3}\right|=\left|A_{1}\right|+\left|A_{2}\right|+\left|A_{3}\right|-\left|A_{1} \cap A_{2}\right| \\
- & \left|A_{2} \cap A_{3}\right|-\left|A_{3} \cap A_{1}\right|+\left|A_{1} \cap A_{2} \cap A_{3}\right| \\
= & 30+28+25-20-16-17+10 \\
= & 40,
\end{aligned}
$$

which means the number of students who excel in at least one of mathematics, physics, and chemistry is 40.