<s>[INST] Closed form formula for an expression involving sums of products. I am stuck trying to simplify or find a closed form formula for the following expression:
$$\sum_{i=0}^{n-1} (\prod_{y=i+1}^{n-1}\frac{y+1}{y+2} \div \prod_{x=i+1}^{k-2}\frac{x+1}{x+2})$$
The function is dependent on 2 variables $n$, and $k$. $k$ can range from 1 to n. What I am essentially trying to do is find the product of $\frac{i+2}{i+3} \cdot \frac{i+3}{i+4} \cdot... \cdot\frac{n}{n+1}$.  However when the variable $k$ is larger than $i+2$, remove the product of the terms $\frac{i+2}{i+3} \cdot \frac{i+3}{i+4} \cdot... \cdot\frac{k-1}{k}$ by dividing them out of the original $\frac{i+2}{i+3} \cdot \frac{i+3}{i+4} \cdot... \cdot\frac{n}{n+1}$.
If anyone has any advice or a more efficient way to approach my desired goal of removing the  i+2 to k-2 product values when k is larger than i+2 it would be much appreciated. Thank you.
 [/INST] When looking at
\begin{align*}
\sum_{i=0}^{n-1}\left (\prod_{y=i+1}^{n-1}\frac{y+1}{y+2} \div \prod_{x=i+1}^{k-2}\frac{x+1}{x+2}\right)\qquad 1\leq k\leq n\tag{1}
\end{align*}
we observe the right-hand product $\prod_{x=i+1}^{\color{blue}{k-2}}\frac{x+1}{x+2}$ is empty resulting in $1$ if $k\in\{1,2\}$. We consider therefore two cases.

Case I: $k\in\{1,2\}$
We obtain from (1)
\begin{align*}
\color{blue}{\sum_{i=0}^{n-1}\prod_{y=i+1}^{n-1}\frac{y+1}{y+2}}
&=\sum_{i=0}^{n-1}\frac{\prod_{y=i+1}^{n-1}(y+1)}{\prod_{y=i+1}^{n-1}(y+2)}\tag{2}\\
&=\sum_{i=0}^{n-1}\frac{\prod_{y=i+1}^{n-1}(y+1)}{\prod_{y=i+2}^{n}(y+1)}\tag{3}\\
&=\sum_{i=0}^{n-1}\frac{i+2}{n+1}\tag{4}\\
&=\frac{1}{n+1}\left(\frac{1}{2}(n-1)n+2n\right)\tag{5}\\
&\,\,\color{blue}{=\frac{n(n+3)}{2(n+1)}}
\end{align*}

Comment:

*

*In (2) we rearrange the expression by writing products for numerator and denominator.


*In (3) we shift the index of the product of the denominator to prepare for cancellation.


*In (4) we do the cancellation.


*in (5) we factor out $\frac{k}{n+1}$ and apply finite summation formulas.

Case II: $3\leq k\leq n$
We obtain:
\begin{align*}
\color{blue}{\sum_{i=0}^{n-1}}&\color{blue}{\left(\prod_{y=i+1}^{n-1}\frac{y+1}{y+2}\div\prod_{x=i+1}^{k-2}\frac{x+1}{x+2}\right)}\\
&=\sum_{i=0}^{n-1}\prod_{y=i+1}^{n-1}\frac{y+1}{y+2}\cdot \prod_{x=i+1}^{k-2}\frac{x+2}{x+1}\tag{6}\\
&=\sum_{i=0}^{k-3}\prod_{y=i+1}^{n-1}\frac{y+1}{y+2}\cdot \prod_{x=i+1}^{k-2}\frac{x+2}{x+1}
+\sum_{i=k-2}^{n-1}\prod_{y=i+1}^{n-1}\frac{y+1}{y+2}\tag{7}\\
&=\sum_{i=0}^{k-3}\frac{\prod_{y=i+1}^{n-1}(y+1)}{\prod_{y=i+1}^{n-1}(y+2)}
\cdot \frac{\prod_{x=i+1}^{k-2}(x+2)}{\prod_{x=i+1}^{k-2}(x+1)}
+\sum_{i=0}^{k-3}\frac{\prod_{y=i+1}^{n-1}(y+1)}{\prod_{y=i+1}^{n-1}(y+2)}\tag{8}\\
&=\sum_{i=0}^{k-3}\frac{\prod_{y=i+1}^{n-1}(y+1)}{\prod_{y=i+2}^{n}(y+1)}
\cdot \frac{\prod_{x=i+2}^{k-1}(x+1)}{\prod_{x=i+1}^{k-2}(x+1)}
+\sum_{i=0}^{k-3}\frac{\prod_{y=i+1}^{n-1}(y+1)}{\prod_{y=i+2}^{n}(y+1)}\tag{9}\\
&=\sum_{i=0}^{k-3}\frac{i+2}{n+1} \cdot \frac{k}{i+2}+\sum_{i=k-2}^{n-1}\frac{i+2}{n+1} \tag{10}\\
&=\frac{1}{n+1}\left(k\sum_{i=0}^{n-1} 1+\sum_{i=k-2}^{n-1}(i+2)\right)\\
&=\frac{1}{n+1}\left(kn+\frac{1}{2}(n-1)n+2n-\frac{1}{2}(k-3)(k-2)-2(k-2)\right)\tag{11}\\
&\,\,\color{blue}{=\frac{1}{2}n+1+\frac{k(k-3)}{2(n+1)}}
\end{align*}

Comment:

*

*In (6) we take the reciprocal of the right-hand product and use multiplication ($\cdot$) instead of division ($\div$).


*In (7) we split the sum respecting the empty product similarly to the first case.


*In (8) we rearrange the expression by writing products  for numerator and denominator.


*In (9) we shift indices similarly to (3).


*In (10) we do the cancellation.


*In (11) we apply finite summation formulas similarly as in (5).
</s>