TrinomialCoefficient - crowlogic/arb4j GitHub Wiki
Proof of the Trinomial Theorem
The Trinomial Theorem states that for any non-negative integer $n$ and real or complex numbers $a$, $b$, and $c$, the expansion of the power of a trinomial $(a + b + c)^n$ is given by:
$$ (a + b + c)^n = \sum_{p+q+r=n} \frac{n!}{p! q! r!} a^p b^q c^r $$
where the sum is taken over all non-negative integers $p$, $q$, and $r$ such that $p + q + r = n$.
Proof
The proof is based on the principle of counting. The expression $(a + b + c)^n$ represents the sum of all possible products of $n$ factors, each of which is either $a$, $b$, or $c$. Each term in the expanded expression corresponds to a particular combination of $p$ occurrences of $a$, $q$ occurrences of $b$, and $r$ occurrences of $c$, such that $p + q + r = n$.
Combinatorial Argument:
-
Counting the Terms: Consider a sequence of $n$ slots, each of which will be filled with either $a$, $b$, or $c$. The number of ways to choose $p$ slots for $a$ out of $n$ slots is $\binom{n}{p}$. After choosing $p$ slots for $a$, there are $n - p$ slots left.
-
Choosing for $b$ and $c$: From the remaining $n - p$ slots, choose $q$ slots for $b$, which can be done in $\binom{n-p}{q}$ ways. This leaves $r = n - p - q$ slots, which will all be filled with $c$.
-
Total Combinations: The total number of ways to arrange $p$ occurrences of $a$, $q$ occurrences of $b$, and $r$ occurrences of $c$ is the product of the number of ways to choose those slots: $\binom{n}{p} \binom{n-p}{q} = \frac{n!}{p!(n-p)!} \cdot \frac{(n-p)!}{q!(n-p-q)!} = \frac{n!}{p!q!r!}$.
-
Conclusion: Summing over all possible non-negative integer combinations of $p$, $q$, and $r$ that sum to $n$ gives the total number of terms in the expansion of $(a + b + c)^n$, each multiplied by the appropriate trinomial coefficient $\frac{n!}{p!q!r!}$, thus proving the theorem.