Artificial intelligent assistant

how to evaluate this sum of binomial coefficients I am reading Jaynes' "probability theory: the logic of science". He occasionally makes derivations from formula's with binomial coefficients that perplex me, but he seems to consider them trivial. For example, he considers it "readily seen" that the following: $$\left( {\matrix{n \\\r}}\right)\sum_{R=0}^N \left(\matrix {N-n \\\R-r}\right)g^R(1-g)^{N-R}$$ is equal to $$\left( {\matrix{n \\\r}}\right)g^r(1-g)^{n-r} $$ How are we supposed to derive this? (and similar equations with factorials/binomial coefficients?)

Try to make a binomial sum appear, and use the Binomial Theorem: $$\begin{align} \sum_{R=0}^N \binom{N-n}{R-r}g^R(1-g)^{N-R} &= g^r(1-g)^{n-r} \sum_{R=0}^N \binom{N-n}{R-r}g^{R-r}(1-g)^{N-n-(R-r)}\\\ &= g^r(1-g)^{n-r} \sum_{k=-r}^{N-n} \binom{N-n}{k}g^{k}(1-g)^{(N-n)-k}\\\ &= g^r(1-g)^{n-r} \sum_{k=0}^{N-n} \binom{N-n}{k}g^{k}(1-g)^{(N-n)-k}\\\ &= g^r(1-g)^{n-r} (g+(1-g))^{N-n}\\\ &= g^r(1-g)^{n-r} 1^{N-n} = g^r(1-g)^{n-r} \end{align}$$

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 43cfc5dac389bbdcd7851bc2912f3917