Multidimensional Matrix Mathematics: Multidimensional .

Transcription

Proceedings of the World Congress on Engineering 2010 Vol IIIWCE 2010, June 30 - July 2, 2010, London, U.K.Multidimensional Matrix Mathematics:Multidimensional Matrix Equality, Addition,Subtraction, and Multiplication, Part 2 of 6Ashu M. G. Solo matrices are equal when each corresponding element is equal.Abstract—This is the first series of research papers to definemultidimensional matrix mathematics, which includesmultidimensional matrix algebra and multidimensional matrixcalculus. These are new branches of math created by the authorwith numerous applications in engineering, math, naturalscience, social science, and other fields. Cartesian and generaltensors can be represented as multidimensional matrices or viceversa. Some Cartesian and general tensor operations can beperformed as multidimensional matrix operations or vice versa.However, many aspects of multidimensional matrix math andtensor analysis are not interchangeable. Part 2 of 6 definesmultidimensional matrix equality as well as themultidimensional matrix algebra operations for addition,subtraction, multiplication by a scalar, and multiplication of twomultidimensional matrices. An alternative representation of thesummation of quadratic terms using multidimensional matrixmultiplication is multidimensional matrix algebra, multidimensional matrixcalculus, matrix math, matrix algebra, matrix calculus, tensoranalysisI. INTRODUCTIONPart 2 of 6 defines multidimensional matrix equality as wellas the multidimensional matrix algebra operations foraddition, subtraction, multiplication by a scalar, andmultiplication of two multidimensional matrices. Also, part 2of 6 describes an alternative representation of the summationof quadratic terms using multidimensional matrixmultiplication.II. MULTIDIMENSIONAL MATRIX EQUALITYTwo multidimensional matrices A and B are consideredequal if and only if A and B have the same number of elementsin each dimension or can be simplified such that they have thesame number of elements in each dimension and allcorresponding elements of these two multidimensionalmatrices are equal. That is, aijk . . . q bijk . . . q for 1 i s, 1 j t, 1 k u, and so on until 1 q z.Just like two tensors are equivalent when eachcorresponding component is equal, two multidimensionalManuscript received March 23, 2010.Ashu M. G. Solo is with Maverick Technologies America Inc., Suite 808,1220 North Market Street, Wilmington, DE 19801 USA (phone: (306)242-0566; email: amgsolo@mavericktechnologies.us).ISBN: 978-988-18210-8-9ISSN: 2078-0958 (Print); ISSN: 2078-0966 (Online)III. MULTIDIMENSIONAL MATRIX ADDITIONMultidimensional matrix addition is performed on anelement-by-element basis. Two multidimensional matricescan only be added if they have the same number of elements ineach dimension or can be simplified such that they have thesame number of elements in each dimension. Consider theaddition of two multidimensional matrices A and B where A B C. The resulting sum matrix C will have the same numberof elements in each dimension as A and B. Its content isdetermined on an element-by-element basis with cijk . . . q aijk . . q bijk . . . q for i 1, 2, . . ., s; j 1, 2, . . ., t; k 1, 2, . . ., u;and so on until q 1, 2, . . ., z.In the following example, a 3-D matrix with dimensions of3 * 2 * 2 is added to another 3-D matrix with dimensions of 3* 2 * 2, and the result is a sum 3-D matrix with dimensions of3 * 2 * 2: 1 4 2 8 3 12 2 5 4 10 6 15 3 6 6 12 9 18 7 10 14 20 21 30 8 11 16 22 24 33 9 12 18 24 27 36 The addition of two tensors is equivalent to the addition oftwo multidimensional matrices with each correspondingcomponent of each tensor being added like eachcorresponding element of each multidimensional matrix isadded.IV. MULTIDIMENSIONAL MATRIX SUBTRACTIONMultidimensional matrix subtraction is performed on anelement-by-element basis. Two multidimensional matricescan only be subtracted if they have the same number ofelements in each dimension or can be simplified such that theyhave the same number of elements in each dimension.Consider the subtraction of two multidimensional matrices Aand B where A - B C. The resulting difference matrix C willhave the same number of elements in each dimension as A andB. Its content is determined on an element-by-element basiswith cijk . . . q aijk . . . q - bijk . . . q for i 1, 2, . . ., s; j 1, 2, . ., t; k 1, 2, . . ., u; and so on until q 1, 2, . . ., z.The subtraction of one tensor from another tensor isequivalent to the subtraction of one multidimensional matrixfrom another with each component of one tensor beingWCE 2010

Proceedings of the World Congress on Engineering 2010 Vol IIIWCE 2010, June 30 - July 2, 2010, London, U.K.subtracted from the corresponding component of anothertensor like each element of one multidimensional matrix issubtracted from the corresponding element of anothermultidimensional matrix.V. MULTIPLICATION OF A MULTIDIMENSIONAL MATRIX BY ASCALARMultiplication of a multidimensional matrix by a scalarresults in multiplying every element of the multidimensionalmatrix by the scalar.In the following example, a 4-D matrix with dimensions of3 * 2 * 1 * 2 is multiplied by the scalar 5 with the resulting 4-Dmatrix with dimensions of 3 * 2 * 1 * 2 as shown: 1 4 7 10 5 20 35 50 5 * 2 5 , 8 11 10 25 , 40 55 3 6 9 12 15 30 45 60 The multiplication of a tensor by a scalar is equivalent tothe multiplication of a multidimensional matrix by a scalarwith each component of the tensor being multiplied by thescalar like each element of the multidimensional matrix ismultiplied by the scalar.VI. MULTIDIMENSIONAL MATRIX PRODUCTIn multidimensional matrix algebra, any two dimensions oftwo multidimensional matrices can be multiplied together.This section describes the multidimensional matrix product,which is an extension and generalization of the matrix productin classical matrix algebra. Note that the multidimensionalmatrix outer product and multidimensional matrix innerproduct are described in separate sections in this series ofresearch papers.A. Notation for Multidimensional Matrix MultiplicationIn the equations below, A represents the firstmultidimensional matrix being multiplied, B represents thesecond multidimensional matrix being multiplied, and Crepresents the multidimensional matrix product.Nd(M) is the number of elements in the dth dimension ofmultidimensional matrix M.The variable da refers to the first and lower dimensionbeing multiplied. The variable db refers to the second andhigher dimension being multiplied. Therefore, db da.Therefore, the variable Nda(A) refers to the number ofelements in the first dimension being multiplied inmultidimensional matrix A, the variable Ndb(A) refers to thenumber of elements in the second dimension being multipliedin multidimensional matrix A, the variable Nda(B) refers tothe number of elements in the first dimension being multipliedin multidimensional matrix B, and the variable Ndb(B) refersto the number of elements in the second dimension beingmultiplied in multidimensional matrix B.The variable n is the number of elements in the seconddimension being multiplied of the first multidimensionalmatrix A or the number of elements in the first dimensionbeing multiplied of the second multidimensional matrix B.That is, n Ndb(A) Nda(B).ISBN: 978-988-18210-8-9ISSN: 2078-0958 (Print); ISSN: 2078-0966 (Online)B. Conformability Requirements for Multidimensional MatrixMultiplicationFor the following conformability requirements, for any 1-Dcolumn vector, there is considered to be a second dimensionhaving a size of one. By the rules of multidimensional matrixsimplification, these are equivalent multidimensionalmatrices.The conformability requirements for multiplication of twomultidimensional matrices are as follows:1. The number of elements in the second dimension beingmultiplied in the first multidimensional matrix mustequal the number of elements in the first dimension beingmultiplied of the second multidimensional matrix. Thatis, Ndb(A) Nda(B). Alternatively, one or both of themultidimensional matrices can be simplified such that thenumber of elements in the second dimension beingmultiplied of the first multidimensional matrix mustequal the number of elements in the first dimension beingmultiplied of the second multidimensional matrix.For example, if the first dimension and seconddimension of multidimensional matrix A andmultidimensional matrix B are being multiplied, thenN2(A) N1(B). If the third dimension and fourthdimension of multidimensional matrix A andmultidimensional matrix B are being multiplied, thenN4(A) N3(B). If the first dimension and fourthdimension of multidimensional matrix A andmultidimensional matrix B are being multiplied, thenN4(A) N1(B).2. The number of elements in each dimension not beingmultiplied in the first multidimensional matrix mustequal the number of elements in the same dimension notbeing multiplied in the second multidimensional matrix.Alternatively, one or both of the multidimensionalmatrices can be simplified such that the number ofelements in each dimension not being multiplied in thefirst multidimensional matrix must equal the number ofelements in the same dimension not being multiplied inthe second multidimensional matrix.For example, if the first dimension and seconddimension of multidimensional matrix A andmultidimensional matrix B are being multiplied, thenNd(A) Nd(B) for d 3. If the third dimension andfourth dimension of multidimensional matrix A andmultidimensional matrix B are being multiplied, thenNd(A) Nd(B) for d 1, d 2, and d 5. If the firstdimension and fourth dimension of multidimensionalmatrix A and multidimensional matrix B are beingmultiplied, then Nd(A) Nd(B) for d 2, d 3, and d 5.If conformability requirements are not met, twomultidimensional matrices cannot be multiplied and theirproduct is nonexistent.If conformability requirements are met, in the resultingmultidimensional matrix product, the number of dimensionsis equal to the number of dimensions in the first or secondmatrix being multiplied.C. Number of Elements in Each Dimension ofMultidimensional Matrix ProductThe number of elements in the first dimension beingmultiplied in the first multidimensional matrix provides theWCE 2010

Proceedings of the World Congress on Engineering 2010 Vol IIIWCE 2010, June 30 - July 2, 2010, London, U.K.number of elements in the corresponding dimension of themultidimensional matrix product. That is, Nda(C) Nda(A).The number of elements in the second dimension beingmultiplied in the second multidimensional matrix provides thenumber of elements in the corresponding dimension of themultidimensional matrix product. That is, Ndb(C) Ndb(B).The number of elements in each other dimension of themultidimensional matrix product is equal to the number ofelements in the same dimension of the first or secondmultidimensional matrix being multiplied.For example, consider the case in which the first and seconddimensions of multidimensional matrix A andmultidimensional matrix B are being multiplied. Then thenumber of elements in the first dimension of multidimensionalmatrix product C is equal to the number of elements in thefirst dimension of multidimensional matrix A. That is, N1(C) N1(A). The number of elements in the second dimension ofmultidimensional matrix product C is equal to the number ofelements in the second dimension of multidimensional matrixB. That is, N2(C) N2(B). The number of elements in otherdimensions of multidimensional matrix product C is equal tothe number of elements in corresponding dimensions ofmultidimensional matrix A or multidimensional matrix B.That is, Nd(C) Nd(A) Nd(B) for d 3.Consider the case in which the second and fifth dimensionsof multidimensional matrix A and multidimensional matrix Bare being multiplied. Then the number of elements in thesecond dimension of multidimensional matrix product C isequal to the number of elements in the second dimension ofmultidimensional matrix A. That is, N2(C) N2(A). Thenumber of elements in the fifth dimension ofmultidimensional matrix product C is equal to the number ofelements in the fifth dimension of multidimensional matrix B.That is, N5(C) N5(B). The number of elements in otherdimensions of multidimensional matrix product C is equal tothe number of elements in corresponding dimensions ofmultidimensional matrix A or multidimensional matrix B.That is, Nd(C) Nd(A) Nd(B) for d 1, 3, 4 and for d 6.D. Multidimensional Matrix MultiplicationIn classical matrix algebra, each individual element of amatrix product is determined as follows:Each individual element in the multidimensional matrixproduct is determined as follows:cijk . . . q n aijk . . . q where x replaces index of db * bijk . . . q where x replaces index of dax 1In this equation, for aijk . . . q, the variable x replaces one of theindices, i, j, k, . . ., q, that corresponds to the second dimensionbeing multiplied, db. Also, in this equation, for bijk . . . q, thevariable x replaces one of the indices, i, j, k, . . ., q, thatcorresponds to the first dimension being multiplied, da.For example, let da 1 and db 4. Then in this equation,for aijk . . . q, the variable x replaces the index l. Also, in thisequation, for bijk . . . q, the variable x replaces the index i. Theresulting equation follows:ncijk . q aix * bxjx 1In this equation, n is the number of elements in the seconddimension of the first matrix or the number of elements in thefirst dimension of the second matrix.The equation for multiplication of classical matrices can beextended to multiplication of multidimensional matrices.aijkx . q * bxjkl . qx 1It is important to note that the equation for multiplication ofclassical matrices is just a special case of the equation formultiplication of multidimensional matrices:ncij aix * bxjx 1According to the equation for multiplication ofmultidimensional matrices, when the first dimension andsecond dimension of multidimensional matrices aremultiplied, corresponding 2-D submatrices, occupying thesame relative positions with respect to third and higherdimensions in both matrices being multiplied, are multipliedtogether using the matrix multiplication method of classicalmatrix algebra.Consider the case where the first dimension and seconddimension are multiplied for a 4-D matrix A with dimensionsof 2 * 3 * 2 * 2 and a 4-D matrix B with dimensions of 3 * 2 *2 * 2. This meets the conformability requirements formultidimensional matrix multiplication because N2(A) N1(B), N3(A) N3(B), and N4(A) N4(B). As shown below,this multidimensional matrix operation results in a 4-D matrixC with dimensions of 2 * 2 * 2 * 2.The following equation is used for multiplication of the firstdimension and second dimension of these two 4-D matrices:ncij ncijkl aixkl * bxjklx 1where n Ndb(A) Nda(B) 3When the first dimension and second dimension of multidimensional matrices are being multiplied, this is equivalent tomultiplying corresponding 2-D submatrices using the matrix multiplication method of classical matrix algebra as shown: 24 21 12 9 1 3 5 13 15 17 23 20 , 11 8 , 22 19 10 7 2 4 6 14 16 18 * (1,2) 7 9 11 19 21 23 18 15 6 3 , 8 10 12 20 22 24 17 14 , 5 2 16 13 4 1 ISBN: 978-988-18210-8-9ISSN: 2078-0958 (Print); ISSN: 2078-0966 (Online)WCE 2010

Proceedings of the World Congress on Engineering 2010 Vol IIIWCE 2010, June 30 - July 2, 2010, London, U.K. 1 24 3 23 5 22 2 24 4 23 6 22 7 18 9 17 11 16 8 18 10 17 12 16 203 272 455 506 176 ,236 374 ,416 491 524 311 326 1 21 3 20 5 19 13 12 15 11 17 10,2 21 4 20 6 19 14 12 16 11 18 107 15 9 14 11 13 19 6 21 5 23 4,8 15 10 14 12 13 20 6 22 5 24 4356 380 122 128 In classical matrix algebra, matrix multiplication alwaysinvolves the first dimension and second dimension becausethere are no other dimensions involved in classical matrixalgebra. In multidimensional matrix algebra, when the firstdimension and second dimension of multidimensionalmatrices are being multiplied, the subscripted dimensions inparentheses “(1, 2)” by the multiplication sign can be omitted.And if the subscripted dimensions in parentheses “(1, 2)” canbe omitted, then the multiplication sign can be omitted. Thatis, A *(1, 2) B A * B AB. This makes the notation formultiplication of 2-D matrices in multidimensional matrixalgebra consistent with classical matrix algebra.The following example shows how the subscripteddimensions “(1, 2)” in parentheses by the multiplication signcan be omitted when the first dimension and seconddimension of multidimensional matrices are being multiplied: 1 1 2 2 *(1, 2) 3 3 4 4 1 1 1 2 2 1 2 2 * 3 4 3 3 4 3 4 4 Consider the case where the first dimension and fourthdimension are multiplied for a 4-D matrix A with dimensionsof 1 * 2 * 2 * 3 and a 4-D matrix B with dimensions of 3 * 2 *2 * 1. This meets the conformability requirements formultidimensional matrix multiplication because N2(A) N1(B), N3(A) N3(B), and N4(A) N4(B). As shown below,this multidimensional matrix operation results in a 4-D matrixC with dimensions of 1 * 2 * 2 * 1 or dimensions of 1 * 2 * 2by the rules of multidimensional matrix simplification.The following formula is used for multiplication of the thirddimension and fourth dimension of these two 4-D matrices:ncijkl 13 9 15 8 17 7 14 9 16 8 18 7 19 3 21 2 23 1 20 3 22 2 24 1 aijkx * bxjklx 1where n Ndb(A) Nda(B) 3ISBN: 978-988-18210-8-9ISSN: 2078-0958 (Print); ISSN: 2078-0966 (Online) 1 2 , 3 4 , 5 6 7 8 , 9 10 , 11 12 *(3, 4) 1 3 5 7 9 112 4 6 8 10 12 35 56 251 308 VII. MULTIDIMENSIONAL MATRIX PRODUCTA summation of quadratic terms can be alternativelyrepresented using multidimensional matrix multiplication.The following equation is used for neural networkapplications. Variables xi,and xj are inputs and wij are weightsfor these inputs:33 w x xij i ji 1 j 1 w11x12 w12x1x2 w13x1x3 w21x2x1 w22x22 w23x2x3 w31x3x1 w32x3x2 w33x32 w11x12 w22x22 w33x32 x1x2 (w12 w21) x1x3 (w13 w31) x2x3 (w23 w32)This weighted summation is easily represented usingclassical matrices multiplied together: w11 w12 w13 x1 3 3wij xi x j x1 x 2 x3 * w21 w22 w23 * x 2 i 1 j 1 w31 w32 w33 x 3 It is extremely useful to express these weighted summationsas matrices multiplied together to eliminate unnecessaryterms in neural network designs. Because both the weights wijand wji in the matrix above correspond to the samesecond-order term xixj, it is sufficient to use only an uppertriangular or lower triangular matrix. For instance, instead ofseparately determining values for w12 and w21, both of whichare weights for x1x2, one can eliminate one of these weightsand determine a value for either w12 or w21 that would be asmuch as both of these combined if they were computedseparately. The same applies for other redundant weights.This saves time in the neural network’s intensive procedure ofcomputing weights.However, the following equation and more complicatedequations used for neural network applications cannot beexpressed using classical matrices. Variables xi, xj, and xk areinputs and wijk are weights for these inputs.WCE 2010

Proceedings of the World Congress on Engineering 2010 Vol IIIWCE 2010, June 30 - July 2, 2010, London, U.K.222 wijk xi x j xki 1 j 1 k 1 w111x13 w112x12x2 w121x12x2 w122x1x22 w211x12x2 w212x1x22 w221x1x22 w222x23 w111x13 x12x2 (w112 w121 w211) x1x22 (w122 w212 w221) w222x23This weighted summation can be alternatively representedusing multidimensional matrices multiplied together.Premultiply the 2 * 2 * 2 weight matrix by a 1 * 2 * 2 inputmatrix in the first dimension and second dimension. Thenpostmultiply the 2 * 2 * 2 weight matrix by a 2 * 1 * 2 inputmatrix in the first dimension and second dimension.Premultiply this entire product by a 1 * 2 input matrix in thefirst dimension and second dimension. Note that because thefirst dimension and second dimension of thesemultidimensional matrices are being multiplied, this does notneed to be indicated in the equations below.22 w111x13 x12x2 (w112 w121 w211) x1x22 (w122 w212 w221) w222x23Thus, this multidimensional matrix multiplication yieldsthe same result as the summation of quadratic terms above.VIII. CONCLUSIONPart 2 of 6 defined multidimensional matrix equality as wellas the multidimensional matrix algebra operations foraddition, subtraction, multiplication by a scalar, andmultiplication of two multidimensional matrices. Also, part 2of 6 described an alternative representation of the summationof quadratic terms using multidimensional matrixmultiplication.Part 3 of 6 defines the multidimensional null matrix andmultidimensional identity matrix. Also, part 3 of 6 defines themultidimensional matrix algebra operations for outer productand inner product.2 wijk xi x j xki 1 j 1 k 1 w111 w121 x1 x1 x 2 w211 w221 x 2 x1 x 2 * * * x1 x 2 w112 w122 x1 w212 w222 x 2 The multidimensional matrix product of the first dimensionand second dimension of the 1 * 2 * 2 input matrix and the 2 *2 * 2 weight matrix results in a 1 * 2 * 2 matrix.22REFERENCES[1][2]Franklin, Joel L. [2000] Matrix Theory. Mineola, N.Y.: Dover.Young, Eutiquio C. [1992] Vector and Tensor Analysis. 2d ed. BocaRaton, Fla.: CRC.2 wijk xi x j xki 1 j 1 k 1 x1 x2 * x1 w111x1 w211x 2 w121x1 w221x 2 x 2 * w112 x1 w212 x 2 w122 x1 w222 x 2 x1 x 2 The multidimensional matrix product of the first dimensionand second dimension of the 1 * 2 * 2 matrix and the 2 * 1 * 2input matrix results in a 1 * 1 * 2 matrix.222 wijk xi x j xki 1 j 1 k 1 w111x12 w211x1x 2 w121x1x 2 w221x22 x2 * 22 w112 x1 w212 x1x 2 w122 x1x 2 w222 x2 The 1 * 1 * 2 matrix can be simplified into a 1-D matrixwith 2 elements, so it can be premultiplied by the 1 * 2 inputmatrix in the first dimension and second dimension. x1222 wijk xi x j xki 1 j 1 k 1 w111x12 w211x1x 2 w121x1x 2 w221x22 x1x2* w112 x2 w212 x1x2 w122 x1x2 w222 x 2 12 w111x13 w112x12x2 w121x12x2 w122x1x22 w211x12x2 w212x1x22 w221x1x22 w222x23 ISBN: 978-988-18210-8-9ISSN: 2078-0958 (Print); ISSN: 2078-0966 (Online)WCE 2010

matrices are equal when each corresponding element is equal. Abstract—This is the first series of research papers to define multidimensional matrix mathematics, which includes mu