How can I manipulate the way matrices multiply/divide to make their shapes match?

96 Views Asked by At

I'm trying to manipulate the way matrices multiply/divide in order to make sure that their shapes match while using the dot product. I'm not sure how well that was explained, so here is an example. Say I have this equation: $\frac{IX}{Y}$ and I know that the shapes are the following:

$$I shape = (1000, 700)$$ $$X shape = (700,30)$$ $$Y shape = (30,10)$$

Notice : I will be using the dot product for multiplication and Moore-Penrose Inverse for division

From this, we can notice that $I * X$ will work correctly with their shapes, and will result in the shape of $(1000, 30)$. If we go on, however, it would try to multiply $(1000, 30)$ and $(10, 30)$ because $\frac{1}{Y}$ will invert the shape. Because this doesn't work, I would change the equation to be $$(I * X) * Y^{-1}$$ where $Y^{-1}$ means that each element is inverted rather than the entire matrix. This works great for my purposes, however I will need to do this a lot with very large equations, so I want to create a program for it. To do that, I need a specific set of steps that I can follow to make the shapes match.

EDIT:

I just realized I forgot to put something essential in here. I want the shapes to match up, but I also want to it try to get a specific shape. In this case I would want it to go from $$\frac{(1000,700)*(700,30)}{(30,10)}$$ to $$(1000, 10)$$