![]() ![]() Let’s strategize before diving headlong into the formulas and note that:ġ) A single row matrix, 1-by-X, multiplied by a single column matrix of compatible size, X-by-1, will result in a 1-by-1 matrix, i.e. Now you know how to do matrix multiplication, let’s use that in an array formula example with the MMULT function. Phew, math aside, let’s get back to the more comfortable ground of our Google Sheet. It takes matrices A and B as arguments, =MMULT(A,B), and outputs the matrix product AB. The MMULT formula does this matrix multiplication for us. (i, k) entry of AB = i th row of A * k th column of B The resulting matrix will have a shape (m, p).Įach entry in the new matrix is defined by the rule In other words if A has shape (m, n) then B must have shape (n, p), for this to work. ![]() The product AB of matrices A = (a ij) and B = (b hk) is defined if and only if the number of columns of A equals the number of rows of B. The only definition worth stating here, that pertains to the MMULT function, is this one: Once I got over the initial shock of seeing “Ben Collins 1999” written on the inside cover (yes, I’m really that old!), I flipped to page 192 and reminisced about the good old days… no, I mean I refreshed my mind on the particulars of matrices, particularly their multiplication. It’s been a while since I’ve done matrix multiplication, so I dug out one of my graduate mathematics books: Sets & Groups, A First Course in Algebra by J.A. Wouldn’t it be nice if we could have a single formula at the top of the column to calculate the running total for us? The principal disadvantage of this formula is this need to fill out the entire column with a new formula for each row. Taking the dataset above, we start our running total in cell C2, with this formula: Let’s start off with the most basic method, using a standard (non-Array) formula which we can then copy down our column. We want to add a running total in column C. This is a lesson from my latest, Google Sheets course on Advanced Formulas 30 Day Challenge (it’s free!).įor the examples that follow, we’ll use this dataset: If you like video tutorials, here’s the one on MMULT: We’ll cover the topic of matrix multiplication (take a deep breath, it’s going to be ok!) using the MMULT formula, one of the more exotic, and challenging formulas in Google Sheets. In this post we’ll look at how to calculate a running total, using a standard method and an array formula method. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |