Where can you put parenthesis inside of matrix multiplication expressions? Does it change if you have a vector involved? I have taken a linear algebra course however now that I have a project involving it I find myself extremely confused by two things. You see the class taught me that AB is not the same as BA but what it didnt help me out with is the ordering.
Yes, I can write out a list of what I need to do to a point but I am confused by which matrix goes on the left or the right. For example if I wanted to take a vector v in a screen space, scale it with matrix S then rotate it with matrix R then translate it with matrix X would the correct operation be v * S * R * X or (S * R * X) * v or S * R * X * v furthermore what is the ordering of these multiplications?
To calculate v * S * R * X can I do it like this (((v * S) * R) * X) or would it need to be like this (v * (S * (R * X))) or something completely different like v * (S * (R * X)) which of these are even equivalent? How do I know?
On top of that confusion I am wondering if a certain property holds however I am having the hardest time testing it because I am not certain about all the ordering/steps stuff above.
Is (S * R * X)^-1 the same as S^-1 * R^-1 * X^-1 or X^-1 * R^-1 * X^-1 or none of the above? You can see how determining this would be difficult  without firm footing on the steps.
Could you please help me clear up which above statements are correct and how I can put parenthesis in these statements without changing the meaning and whether the vector gets multiplied on the left or the right? Additionally does that inverse property hold at all?
If it helps I am working with 3x3 matrices exclusively. Technically I am transforming 2D points with 2D transformations however I have to extend my point to a vector (p.x, p.y, 1) in order to be able to do the transform calculations.
 A: When I do matrix operations, I typically will put the vector all the way on the right, and then for each operation I want to do, I'll add it to the left. So to take a vector $v$, and scale it with $S$, I would write $Sv$. To then rotate it via $R$, and then translate it with $T$, I would write $TRSv$.
The inverse of $TRS$ is $S^{-1}R^{-1}T^{-1}$. You can check this algebraically because when you write them next to each other, you can perform the cancellation without having to move anything—remember, because in general $AB \neq BA$, we should avoid swapping the order at all costs.
NB – What I described in the first paragraph is one convention. Since it is possible to multiply an $n\times n$ matrix and a vector on the left or on the right depending on whether you think of the vector as a $1\times n$ or $n\times 1$ matrix, you could write a consistent program using either standard. If you are working off of some preexisting structure, I would advise trying out both ways to get a feel for which is correct.
