Example 1. Some people stand in a row, among them, A does not stand at the head, and B does not stand at the end. How many ways are there to arrange them?
(1) 䒴
$P_{4}^{4}$

etc. transmission
(2) one of the middle three positions $P_{3}^{\frac{1}{3}} P \frac{1}{3} P_{3}^{3}$, so the number of ways for not standing at the head and not standing at the tail is $P_{4}^{4}+P{ }_{3}^{1} P_{3}^{1} P_{3}^{3}=78$ (benefit).

Solution two (using the properties 2 and 3 mentioned earlier)
Let $A=$ \{arrangements where A stands at the head\},
$B=\{$ arrangements where B stands at the tail\},
$E=\{$ arrangements where five people stand in a row\}.
It is easy to see that $N(A)=N(B)=P{ }_{4}^{4}$,
$$
N(E)=P_{5}^{5}, N(A B)=P_{3}^{3} \text {. }
$$

The number of arrangements required by the problem should be $N(\bar{A} \cap \bar{B})$, by the principle of duality, we know $A \cap B=\overline{A \cup B}$, so
$$
\begin{array}{l}
N(\bar{A} \cap \bar{B})=N(\overline{A \cup B}) \\
=N(E)-N(A \cup B) \\
=N(E)-N(A)-N(B)+N(A B) \\
=P_{5}^{5}-P_{4}^{4}-P_{4}^{4}+P_{3}^{3}=78 \text { (ways). }
\end{array}
$$