# Reindexing the composition of two families of elements of a group

Let $$n,m\in\mathbb{N}_{>0}$$ and let $$(x_{i})_{i\in[1,m]}$$ and $$(y_{j})_{j\in[1,n]}$$ be two families of elements of a group $$G$$ whose law is written multiplicatively. How can I rewrite the composition $$\prod_{i=1}^{m} x_{i}\cdot(\prod_{j=1}^{n} y_{j})^{-1}$$ as a family of elements of $$G$$ over the interval $$[1,m+n]$$? I know that for $$\prod_{i=1}^{m} x_{i}\cdot(\prod_{j=1}^{n} y_{j})$$ I have $$(z_{k})_{k\in[1,m+n]}$$ such that $$\prod_{k=1}^{m+n} z_{k}=\prod_{i=1}^{m} x_{i}\cdot(\prod_{j=1}^{n} y_{j}),$$ where $$\begin{equation*} z_k= \begin{cases} x_k, & 1\leq k\leq m; \\ y_{k-m}, & m+1\leq k\leq m+n. \end{cases} \end{equation*}$$

I tried defining a function $$u$$ such that $$\begin{equation*} u_k= \begin{cases} x_k, & 1\leq k\leq m; \\ y_{(n+1)-(k-m)}, & m+1\leq k\leq m+n. \end{cases} \end{equation*}$$ but I ran into a problem whilst trying to show that $$(\prod_{j=1}^{n} y_{j})^{-1}=\prod_{k=m+1}^{m+n} y_{(n+1)-(k-m)}^{-1};$$ specifically, for the inductive step (induction over $$n$$ with $$m$$ fixed) we have $$\prod_{k=m+1}^{m+(n+1)} y_{((n+1)+1)-(k-m)}^{-1}=\prod_{k=m+1}^{m+n} y_{((n+1)+1)-(k-m)}^{-1}\cdot y^{-1}_{1},$$ but the expression $$\prod_{k=m+1}^{m+n} y_{((n+1)+1)-(k-m)}^{-1}$$ is different from what's assumed for $$n$$: namely $$\prod_{k=m+1}^{m+n} y_{(n+1)-(k-m)}^{-1}$$.

Any hints will be appreciated.

At first glance, I'd do it step-by-step. If $$m=n$$ then

$$\prod_{i=1}^{m}x_i\left(\prod_{j=1}^{m}y_j\right)^{-1} = \prod_{k=1}^{m}x_ky_k^{-1}.$$

If $$m\gt n$$ then

$$\prod_{i=1}^{m}x_i\left(\prod_{j=1}^{n}y_j\right)^{-1} = \prod_{i=1}^{m-n}x_i\prod_{l=1}^{n}x_{l+m-n}\left(\prod_{j=1}^{n}y_j\right)^{-1} = \prod_{i=1}^{m-n}x_i\prod_{k=1}^{n}x_{k+m-n}y_k^{-1}.$$

If $$m\lt n$$ then

$$\prod_{i=1}^{m}x_i\left(\prod_{j=1}^{n}y_j\right)^{-1} = \prod_{i=1}^{m}x_i\left(\prod_{j=1}^{n-m}y_j\prod_{l=1}^{m}y_{l+n-m}\right)^{-1} = \prod_{j=1}^{n-m}y_j\prod_{k=1}^{m}x_ky_{k+n-m}^{-1}.$$

Finally, try to combine all chances in one $$\prod_{k=1}^{m+n}z_{k}$$.