<s>[INST] Li Shanlan's combinatorial identities I am struggling to prove the following combinatorial identities:
$$(1)\quad\sum_{r=0}^m \binom{m}{r}\binom{n}{r}\binom{p+r}{m+n} = \binom{p}{m}\binom{p}{n},\quad \forall n\in\mathbb N,p\ge m,n$$
$$(2)\quad\sum_{r=0}^m \binom{m}{r}\binom{n}{r}\binom{p+m+n-r}{m+n} = \binom{p+m}{m}\binom{p+n}{n},\quad \forall p\in\mathbb N$$
The book I found them in says they were discovered and proved by Chinese mathematician Li Shanlan in the 19th century but I have failed to find any of his works translated into English in the Internet.
I am looking for an either combinatorial or algebraic solution.
 [/INST] Suppose we seek to verify that
$$\sum_{r=0}^{\min\{m,n,p\}} 
{m\choose r} {n\choose r}
{p+m+n-r\choose m+n}
= {p+m\choose m} {p+n\choose n}.$$
Introduce
$${n\choose r} = {n\choose n-r} =
\frac{1}{2\pi i}
\int_{|z|=\epsilon} \frac{1}{z^{n-r+1}} 
(1+z)^n \; dz$$
and
$${p+m+n-r\choose m+n} = {p+m+n-r\choose p-r} \\ =
\frac{1}{2\pi i}
\int_{|w|=\epsilon} \frac{1}{w^{p-r+1}} 
(1+w)^{p+m+n-r} \; dw.$$
Observe carefully  that the first of  these is zero when  $r\gt n$ and
the second  one when $r\gt  p$ so  we may extend  the range of  $r$ to
infinity.

This yields for the sum
$$\frac{1}{2\pi i}
\int_{|z|=\epsilon} \frac{(1+z)^n}{z^{n+1}} 
\frac{1}{2\pi i}
\int_{|w|=\epsilon} \frac{(1+w)^{p+m+n}}{w^{p+1}} 
\sum_{r\ge 0} {m\choose r} z^r \frac{w^r}{(1+w)^r}
\; dw \; dz
\\ = \frac{1}{2\pi i}
\int_{|z|=\epsilon} \frac{(1+z)^n}{z^{n+1}} 
\frac{1}{2\pi i}
\int_{|w|=\epsilon} \frac{(1+w)^{p+m+n}}{w^{p+1}} 
\left(1+\frac{zw}{1+w}\right)^m
\; dw \; dz
\\ = \frac{1}{2\pi i}
\int_{|z|=\epsilon} \frac{(1+z)^n}{z^{n+1}} 
\frac{1}{2\pi i}
\int_{|w|=\epsilon} \frac{(1+w)^{p+n}}{w^{p+1}} 
(1+w+zw)^m
\; dw \; dz.$$
The inner integral is
$$\frac{1}{2\pi i}
\int_{|w|=\epsilon} \frac{(1+w)^{p+n}}{w^{p+1}} 
\sum_{q=0}^m {m\choose q} (1+z)^q w^q
\; dw$$
with residue
$$\sum_{q=0}^{\min(m,p)} {m\choose q} {p+n\choose p-q}
(1+z)^q$$
which in combination with the outer integral yields
$$\sum_{q=0}^{\min(m,p)} {m\choose q} {p+n\choose n+q}
{n+q\choose n}.$$
Now note that
$${p+n\choose n+q} {n+q\choose n}
= \frac{(p+n)!}{(p-q)! (n+q)!} \frac{(n+q)!}{q! n!}
\\ = \frac{(p+n)!}{(p-q)! p!} \frac{p!}{q! n!}
= {p+n\choose n} {p\choose q}.$$
Therefore we just need to verify that
$$\sum_{q=0}^{\min(m,p)} {m\choose q} {p\choose p-q}
= {p+m\choose m}$$
which follows by inspection.
It can also be done with the integral
$${p\choose p-q} =
\frac{1}{2\pi i}
\int_{|w|=\epsilon} \frac{(1+w)^{p}}{w^{p-q+1}} \; dw$$ 
which is zero when $q\gt p$ so we can extend $q$ to infinity
to get for the sum
$$\frac{1}{2\pi i}
\int_{|w|=\epsilon} \frac{(1+w)^{p}}{w^{p+1}} 
\sum_{q\ge 0} {m\choose q} w^q
\; dw
\\ = \frac{1}{2\pi i}
\int_{|w|=\epsilon} \frac{(1+w)^{p+m}}{w^{p+1}} 
\; dw
\\ = {p+m\choose m}.$$ 
</s>