# Adding higher dimensional matrices

I want to check my understanding of matrices in this kind of notation;

Suppose I want to represent a matrix for a sprite that contains the sprite's position(x, y), sprite's velocity (x, y), and sprite's acceleration (x, y).

I can construct such matrices as follows:

$$newSprite \quad pos \quad vel \quad acc = \left[\begin{array}{l} pos \\ vel \\ acc \end{array}\right] \\ where \quad pos : \mathbb{R}^2, vel : \mathbb{R}^2, acc : \mathbb{R}^2$$

So that a sprite with pos {x: 0, y: 0}, vel {x: 0, y: 0}, acc: {x: 0, y: -9.8} would be newSprite (0, 0) (0, 0) (0, -9.8) which results in

$$\left[\begin{array}{l} \left[\begin{array}{l} 0 \\ 0 \end{array}\right]\\ \left[\begin{array}{l} 0 \\ 0 \end{array}\right]\\ \left[\begin{array}{l} 0 \\ -9.8 \end{array}\right] \end{array}\right]$$

Now; I want to describe a matrix for making the sprite jump. To do this; I want to add some amount to the velocity of the sprite.

Without flattening the matrix into a flat matrix of 6 values, is it allowed to do the following? (For the sake of avoiding conditional, we are allowed to jump while still in the air, repeated jumps increase speed twice)

$$jumpAdditiveMatrix = \left[\begin{array}{l} \left[\begin{array}{l} 0\\ 0 \end{array}\right]\\ \left[\begin{array}{l} 0\\ 20 \end{array}\right]\\ \left[\begin{array}{l} 0\\ 0 \end{array}\right] \end{array}\right]$$

So that

worldState2 = let worldState = newSprite $\left[\begin{array}{l}0\\0\end{array}\right]$ $\left[\begin{array}{l}0\\0\end{array}\right]$ $\left[\begin{array}{l}0\\-9.8\end{array}\right]$ in

Basically; my concern is that I get the following notation:

$$\left[\begin{array}{l} \left[\begin{array}{l} 0 \\ 0 \end{array}\right]\\ \left[\begin{array}{l} 0 \\ 0 \end{array}\right]\\ \left[\begin{array}{l} 0 \\ -9.8 \end{array}\right] \end{array}\right] + \left[\begin{array}{l} \left[\begin{array}{l} 0\\ 0 \end{array}\right]\\ \left[\begin{array}{l} 0\\ 20 \end{array}\right]\\ \left[\begin{array}{l} 0\\ 0 \end{array}\right] \end{array}\right]$$

and while I know that

$$\left[\begin{array}{l} 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ -9.8 \end{array}\right] + \left[\begin{array}{l} 0\\ 0\\ 0\\ 20\\ 0\\ 0 \end{array}\right] = \left[\begin{array}{l} 0\\ 0\\ 0\\ 20\\ 0\\ -9.8 \end{array}\right]$$

holds; I don't know whether the following holds

$$\left[\begin{array}{l} \left[\begin{array}{l} 0 \\ 0 \end{array}\right]\\ \left[\begin{array}{l} 0 \\ 0 \end{array}\right]\\ \left[\begin{array}{l} 0 \\ -9.8 \end{array}\right] \end{array}\right] + \left[\begin{array}{l} \left[\begin{array}{l} 0\\ 0 \end{array}\right]\\ \left[\begin{array}{l} 0\\ 20 \end{array}\right]\\ \left[\begin{array}{l} 0\\ 0 \end{array}\right] \end{array}\right] = \left[\begin{array}{l} \left[\begin{array}{l} 0\\ 0 \end{array}\right]\\ \left[\begin{array}{l} 0\\ 20 \end{array}\right]\\ \left[\begin{array}{l} 0\\ -9.8 \end{array}\right] \end{array}\right]$$

Does the above hold or not?

• It holds if you want it to. That's not any standard notation that I've ever seen, so it means whatever you want it to mean. In Maple the answer would be no, I believe...unless you wrote a package that had an addition function that would make the answer yes. – Matt Samuel Apr 1 '17 at 23:09
• These "block" notations could be directly implemented in a Matlab program for example. – Jean Marie Apr 1 '17 at 23:16
• my question is whether such an expression have addition defined on it, and we rarely use it(if it's within our algebra), or if this construct is not closed under addition and such a binary operator is outside our algebra; in a pure sense. That is whether the nonflat matrix construct is defined, and whether there's an additive Monoid defined for it. Or if a new algebra is needed to support such a construct. – Dmitry Apr 1 '17 at 23:16
• I'm also concerned if such a construct is within our algebra but behaves differently than I expect. Im aware that I can make it hold but I'm not sure if doing so causes contradictions in our current algebra. – Dmitry Apr 1 '17 at 23:21
• Sure, this works. The concept you are looking for is the "direct sum of vector spaces". – Nick Alger Apr 2 '17 at 0:08