Mathematics
Matrix Addition and Subtraction
Matrix addition and subtraction involve adding or subtracting corresponding elements of two matrices to create a new matrix. This is done by adding or subtracting the elements in the same position in each matrix. The resulting matrix will have the same dimensions as the original matrices.
Written by Perlego with AI-assistance
Related key terms
1 of 5
10 Key excerpts on "Matrix Addition and Subtraction"
- eBook - PDF
MATLAB
An Introduction with Applications
- Amos Gilat(Author)
- 2016(Publication Date)
- Wiley(Publisher)
It is expected that almost every MATLAB user has some knowledge of matrix operations and linear algebra, and thus will be able to follow the material covered in Sections 3.2 and 3.3 without any difficulty. Some readers, however, might prefer to read Section 3.4 first. MATLAB can be used with element-by- element operations in numerous applications that do not require linear algebra multiplication (or division) operations. 64 Chapter 3: Mathematical Operations with Arrays 3.1 ADDITION AND SUBTRACTION The operations + (addition) and – (subtraction) can be used to add (subtract) arrays of identical size (the same numbers of rows and columns) and to add (subtract) a scalar to an array. When two arrays are involved the sum, or the dif- ference, of the arrays is obtained by adding, or subtracting, their corresponding elements. In general, if A and B are two arrays (for example, matrices), and then the matrix that is obtained by adding A and B is: Examples are: >> VectA=[8 5 4]; VectB=[10 2 7]; >> VectC=VectA+VectB VectC = 18 7 11 >> A=[5 -3 8; 9 2 10] A = 5 -3 8 9 2 10 >> B=[10 7 4; -11 15 1] B = 10 7 4 -11 15 1 >> A-B ans = -5 -10 4 20 -13 9 >> C=A+B C = 15 4 12 -2 17 11 >> VectA+A ??? Error using ==> plus Matrix dimensions must agree. >> Define two vectors. Define a vector VectC that is equal to VectA+VectB. Define two matrices A and B. Subtracting matrix B from matrix A. Define a matrix C that is equal to A+B. Trying to add arrays of different size. An error message is displayed. 3.2 Array Multiplication 65 When a scalar (number) is added to (or subtracted from) an array, the scalar is added to (or subtracted from) all the elements of the array. Examples are: 3.2 ARRAY MULTIPLICATION The multiplication operation * is executed by MATLAB according to the rules of linear algebra. This means that if A and B are two matrices, the operation A*B can be carried out only if the number of columns in matrix A is equal to the number of rows in matrix B. - eBook - PDF
- Stefan Waner, Steven Costenoble(Authors)
- 2017(Publication Date)
- Cengage Learning EMEA(Publisher)
To add (or subtract) two matrices of the same dimensions, we add (or subtract) the corresponding entries. More formally, if A and B are m 3 n matrices, then A 1 B and A 2 B are the m 3 n matrices whose entries are given by 1 A 1 B 2 ij 5 A ij 1 B ij ij th entry of the sum 5 Sum of the ij th entries 1 A 2 B 2 ij 5 A ij 2 B ij . ij th entry of the difference 5 Difference of the ij th entries Visualizing Matrix Addition C 2 2 3 1 0 S 1 C 1 1 2 2 1 S 5 C 3 2 2 2 1 1 S Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-300 4.1 Matrix Addition and Scalar Multiplication 257 Sales The A-Plus auto parts store chain has two outlets, one in Vancouver and one in Quebec. Among other things, it sells wiper blades, windshield cleaning fluid, and floor mats. The monthly sales of these items at the two stores for 2 months are given in the following tables: January Sales Vancouver Quebec Wiper Blades 20 15 Cleaning Fluid (bottles) 10 12 Floor Mats 8 4 February Sales Vancouver Quebec Wiper Blades 23 12 Cleaning Fluid (bottles) 8 12 Floor Mats 4 5 Use matrix arithmetic to calculate the change in sales of each product in each store from January to February. Solution The tables suggest two matrices: J 5 C 20 15 10 12 8 4 S and F 5 C 23 12 8 12 4 5 S . To compute the change in sales of each product for both stores, we want to subtract corresponding entries in these two matrices. In other words, we want to compute the difference of the two matrices: F 2 J 5 C 23 12 8 12 4 5 S 2 C 20 15 10 12 8 4 S 5 C 3 2 3 2 2 0 2 4 1 S . Thus, the change in sales of each product is the following: Vancouver Quebec Wiper Blades 3 2 3 Cleaning Fluid (bottles) 2 2 0 Floor Mats 2 4 1 Scalar Multiplication A matrix A can be added to itself because the expression A 1 A is the sum of two matrices that have the same dimensions. When we compute A 1 A , we end up doubling every entry in A . - eBook - PDF
- Stefan Waner, Steven Costenoble(Authors)
- 2017(Publication Date)
- Cengage Learning EMEA(Publisher)
To add (or subtract) two matrices of the same dimensions, we add (or subtract) the corresponding entries. More formally, if A and B are m 3 n matrices, then A 1 B and A 2 B are the m 3 n matrices whose entries are given by 1 A 1 B 2 ij 5 A ij 1 B ij ij th entry of the sum 5 Sum of the ij th entries 1 A 2 B 2 ij 5 A ij 2 B ij . ij th entry of the difference 5 Difference of the ij th entries Visualizing Matrix Addition C 2 2 3 1 0 S 1 C 1 1 2 2 1 S 5 C 3 2 2 2 1 1 S Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-300 5.1 Matrix Addition and Scalar Multiplication 325 Sales The A-Plus auto parts store chain has two outlets, one in Vancouver and one in Quebec. Among other things, it sells wiper blades, windshield cleaning fluid, and floor mats. The monthly sales of these items at the two stores for 2 months are given in the following tables: January Sales Vancouver Quebec Wiper Blades 20 15 Cleaning Fluid (bottles) 10 12 Floor Mats 8 4 February Sales Vancouver Quebec Wiper Blades 23 12 Cleaning Fluid (bottles) 8 12 Floor Mats 4 5 Use matrix arithmetic to calculate the change in sales of each product in each store from January to February. Solution The tables suggest two matrices: J 5 C 20 15 10 12 8 4 S and F 5 C 23 12 8 12 4 5 S . To compute the change in sales of each product for both stores, we want to subtract corresponding entries in these two matrices. In other words, we want to compute the difference of the two matrices: F 2 J 5 C 23 12 8 12 4 5 S 2 C 20 15 10 12 8 4 S 5 C 3 2 3 2 2 0 2 4 1 S . Thus, the change in sales of each product is the following: Vancouver Quebec Wiper Blades 3 2 3 Cleaning Fluid (bottles) 2 2 0 Floor Mats 2 4 1 Scalar Multiplication A matrix A can be added to itself because the expression A 1 A is the sum of two matrices that have the same dimensions. When we compute A 1 A , we end up doubling every entry in A . - eBook - PDF
- Marvin Tobias(Author)
- 2022(Publication Date)
- Springer(Publisher)
For example, A = B iff they both have the same dimensions, mXn, and a ij = b ij , for all i and j . 1.2.1 ADDITION (INCLUDING SUBTRACTION) The sum of two (or more) matrices is formed by summing corresponding elements: C = B ± A implies [c ij ] = [b ij ] ± [a ij ] . (1.4) Note that if the two matrices are of different dimensionality then corresponding elements cannot be found, in which case addition is not defined. Matrix addition is defined only when B and A have the same numbers of rows and columns, respectively. When this is the case, the matrices A and B are said to be “conformable in addition.” If all the elements of A are respectively the negatives of those of B, then the sum, C, will have all zero elements. In such case, C is known as a “null” matrix (the “zero” of matrix algebra). Also, if A happened to be null, then C would be equal to B, c ij = b ij for all i and j . Since addition is commutative for the elements of the matrix, then matrix addition itself is commutative. That is, A + B = B + A. 1.2.2 MULTIPLICATION BY A SCALAR The matrix (k)A is formed by multiplying every element of A by the scalar (k). Note that the notation (k), with parentheses, is used here. However, the notation, kA, will also be used. Neither (k)A, nor kA, will be confused with matrix multiplication, because row, or column, vectors (also expressed in lower case) must be written as {k}, or [k]. In passing, we note that if A is square (nXn), and is multiplied by the scalar, k, then the determinant of A will be multiplied by k n . Conversely, then (k)|A| will mean the multiplication of a single row, or column, by k. More on this, later. 1.2.3 VECTOR MULTIPLICATION Since rectangular matrices are composed of vectors, we will first discuss vector products, before defining the product of these “larger” matrices. The most important product of two vectors is their “dot product,” or “scalar product.” This product results in a scalar—just as does the vector dot product in vector analysis. - eBook - PDF
- Al Cuoco, Kevin Waterman, Bowen Kerins, Elena Kaczorowski(Authors)
- 2019(Publication Date)
- American Mathematical Society(Publisher)
For You to Do 4. Let A = 2 4 − 3 − 4 3 1 and B = 4 8 − 6 4 − 3 − 1 . Calculate A + B using each of the three methods given in the definition. Scalar multiplication is defined for vectors, and that definition carries over to matrices. This is one place where thinking of a matrix as a list of vectors comes in handy. Definition If A is an m × n matrix and c is a scalar, then the multiplication of a ma trix by a scalar , written cA , is an m × n matrix defined by any of these: • ( cA ) ij = cA ij • ( cA ) i ∗ = cA i ∗ • ( cA ) ∗ j = cA ∗ i Scalar multiplication can be carried out by multiplying through each entry , but it can also be carried out by performing scalar multiplication on the row or column vectors . With these two operations, you can start building the list of basic rules of matrix algebra. Theorem 4.1 (The Basic Rules of Matrix Algebra) Suppose that A , B , and C are matrices of the same size, and that d and e are scalars. Then (1) A + B = B + A (2) A + ( B + C ) = ( A + B ) + C (3) A + O = A ←− What do you think O represents here? (4) A + ( − 1) A = O 156 4.2 Adding and Scaling Matrices (5) ( d + e ) A = dA + eA (6) d ( A + B ) = dA + dB (7) d ( eA ) = ( de ) A (8) 1 A = A These properties should look familiar. They were seen in Chapter 1 applied to vectors. The notation ( 1 2 3 ) can now stand for a vector, a point, or a matrix (with one row), and the properties in Theorem 4.1 apply to all three. Developing Habits of Mind Look for structural similarity. Because of part ((4)) of Theorem 4.1, the matrix ←− Some call − A the ”additive inverse” of A . − 1 A is called either the opposite of A or the negative of A . The shorthand − A can be used, but it really means − 1 A . You may have noticed there was no definition for subtraction of matrices. For numbers, subtraction is defined in terms of adding the opposite: x − y = x + ( − y ). The same definition can now be used for subtraction of matrices: A − B = A + ( − B ), where − B means − 1 B . - David C. Vella(Author)
- 2021(Publication Date)
- Cambridge University Press(Publisher)
Thus, ⎡ ⎣ 1 0 1 2 1 7 ⎤ ⎦ − ⎡ ⎣ −1 0 −1 1 1 −3 ⎤ ⎦ = ⎡ ⎣ 2 0 2 1 0 10 ⎤ ⎦ . The following theorem summarizes what happens when matrix addition is combined with trans- position and/or scalar multiplication. theorem 2.3 Let A, B , and C be matrices, and let r,s be real numbers. Also, let 0 be a matrix (regardless of size) with all entries equal to 0 (called a zero matrix). The following rules hold: a. A + B = B + A (commutative law for matrix addition). b. A + (B + C) = (A + B ) + C (associative law for matrix addition). c. s (A + B ) = sA + sB (distributive law for scalar multiplication over matrix addition). d. A + 0 = A (where 0 is a zero matrix the same size as A). e. Given A, there is another matrix, denoted −A, with the property that A + (−A) =0, where 0 is as in Part d. −A is called the additive inverse of A. f. −A = (−1)A (the additive inverse of A is the same as the scalar multiple (−1)A). g. (A + B ) T = A T + B T (transposition distributes over matrix addition). h. (sA) T = s (A T ) (transposition commutes with scalar multiplication). i. r (sA) = (rs )A (associative law for scalar multiplication). These properties will be illustrated in the exercises. We do not give formal proofs, which can be found in any linear algebra text and are quite easy in any case. Mathematically mature readers will be asked to supply some of the proofs in the exercises. 68 Matrix Algebra 2.2.4 Matrix Multiplication Given two matrices A and B, it may or may not be possible to multiply them together, depending on their dimensions. The definition of the matrix product is not as simple as that for the matrix sum. In order to understand how multiplication works, it is useful to consider first a special case – that of a row matrix times a column matrix. So suppose we have the following row matrix A and column matrix B : A = a 1 a 2 a 3 . . . a n B = ⎡ ⎢ ⎢ ⎢ ⎢ ⎢ ⎣ b 1 b 2 b 3 . . . b r ⎤ ⎥ ⎥ ⎥ ⎥ ⎥ ⎦ .- Lukes(Author)
- 1982(Publication Date)
- Academic Press(Publisher)
20 rectangular array 2. Matrix Algebra-The Natural Language of Linear Systems A··· m2 (2.1.1) the index (variable) i is interpreted as a row position and j as the column position. Conversely, every such array offield elements determines a matrix A over IF. If m = n, the A is called square. The positions in A occupied by Au (i = 1, 2, ... , n) are referred to as the main diagonal. A square matrix is called a diagonal matrix if all its elements off the main diagonal are zero, and a diagonal matrix A with all A ii = c is called a scalar matrix, which is identified with the scalar c in IF. An upper-triangular matrix is one whose elements Aij satisfy Aij = 0 for i > j, and a lower-triangular matrix is one satisfying that equality for i < j. 2.2 Addition, Multiplication, and Scalar Multiplication Problems of working with large numbers of scalar variables and numerical data motivated development of matrix algebra as an extension of the one-dimensional scalar case. The following are the standard operations which arose: Definition Let A and B be m x n matrices over a field IF. The matrix sum A + B is the m x n matrix defined by (A + B)ij = Aij + Bij' (2.2.1) It is a simple matter to verify the following consequences of definition (2.2.1): A + B = B + A; A + (B + C) = (A + B) + C for all m x n matrices A, B, C over IF; A+Z=A (2.2.2) (2.2.3) (2.2.4) has a unique solution for each m x n A, namely, Zij = 0 for all i.j; Z is called the m x n zero matrix and is denoted by 0; and A+N=O (2.2.5) has a unique solution N for each m x n matrix A, namely, N ij = -A ij for all i,j; N is called the additive inverse of A. The standard notation for N is -A. 2.1 Addition, Multiplication, and Scalar Multiplication 21 Definition A second operation on an m x n matrix A over f/i called scalar multiplication by c in f/i is defined by (CA)ij = cA ij for all i,j.- No longer available |Learn more
- (Author)
- 2014(Publication Date)
- Learning Press(Publisher)
Addition in abstract algebra In linear algebra, a vector space is an algebraic structure that allows for adding any two vectors and for scaling vectors. A familiar vector space is the set of all ordered pairs of real numbers; the ordered pair ( a , b ) is interpreted as a vector from the origin in the ________________________ WORLD TECHNOLOGIES ________________________ Euclidean plane to the point ( a , b ) in the plane. The sum of two vectors is obtained by adding their individual coordinates: ( a , b ) + ( c , d ) = ( a + c , b + d ). This addition operation is central to classical mechanics, in which vectors are interpreted as forces. In modular arithmetic, the set of integers modulo 12 has twelve elements; it inherits an addition operation from the integers that is central to musical set theory. The set of integers modulo 2 has just two elements; the addition operation it inherits is known in Boolean logic as the exclusive or function. In geometry, the sum of two angle measures is often taken to be their sum as real numbers modulo 2π. This amounts to an addition operation on the circle, which in turn generalizes to addition operations on many-dimensional tori. The general theory of abstract algebra allows an addition operation to be any asso-ciative and commutative operation on a set. Basic algebraic structures with such an addition operation include commutative monoids and abelian groups. Addition in set theory and category theory A far-reaching generalization of addition of natural numbers is the addition of ordinal numbers and cardinal numbers in set theory. These give two different generalizations of addition of natural numbers to the transfinite. Unlike most addition operations, addition of ordinal numbers is not commutative. Addition of cardinal numbers, however, is a commutative operation closely related to the disjoint union operation. - Shawna Lockhart, Eric Tilleson(Authors)
- 2019(Publication Date)
- SDC Publications(Publisher)
We got: 9 10 2 10 7 1 3 6 10 10 The command rng(0) resets the random number generator, so you get the same seed every time, and therefore the same sequence of numbers. The ability to reproduce a “random” sequence of numbers turns out to be a good thing because it allows you to use consistent data when you’re testing your code. Array Math Operations Array math operations are the most straightforward of matrix math operations, because they are performed on each element separately. To perform array math operations, the arrays involved must have the same dimensions. These operations apply to matrices, but they can also apply to three-dimensional and higher arrays. Review the Arrays and Struc- tures tutorial as a refresher for array basics. Matrix Addition and Subtraction 87 Matrix Addition and Subtraction You can add two or more matrices together or subtract one matrix from another. Again, the rule is that all matrices in the equation must have the same dimensions (same number of rows and columns). Each element in one matrix is matched with the corresponding element at the same position in the other matrix (or matrices) and the operation is applied. For matrix addition with matrix A and B, A(1,1) is added to B(1,1), A(1,2) is added to B(1,2), etc. Here it is visually: f e d c b a + m l k j i h = + + + + + + m f l e k d j c i b h a Matrix subtraction works in the same way. Notice that order counts, just as it does when you subtract one scalar from another: A – B is not the same as B - A. (If you remember your grade school math terms, this says that subtraction is not commutative.) f e d c b a − m l k j i h = − − − − − − m f l e k d j c i b h a Try it out in the next steps. Because you will be using random number generators, your values will not exactly match the examples shown.- eBook - PDF
- Joel W. Robbin(Author)
- 2018(Publication Date)
- A K Peters/CRC Press(Publisher)
row 30 2. MATRIX OPERATIONS Definition 30A (M atrix Equality) Two matrices are equal iff they have the same size and corresponding entries are equal. In other words, for two matrices A ,B e F mXn of the sames size we have A = B entry tJ(A) = entry^B) for i = 1 ,2 ,..., m, j = 1 ,2 ,..., n; matrices of different sizes are never equal. > Question 30B Does 2.2 A dditive Operations on M atrices The operations defined in this section are entry wise operations. This means that the (z, j)-entry of the output is determined by the (z,j gentries of the inputs. This can be contrasted with the operation of matrix multi plication defined in Definition 32C. Definition 30C (M atrix Addition) The sum of two matrices of the same size is defined by entry wise addition. More precisely, two matrices A E F mXn and B E F mXn determine a third matrix A + B E F mXn by the rule entry ij (A + B) = entry 0·(A) + entry ^(B) for i = 1 ,2 ,... ,m, j = 1, 2 ,..., n. Exam ple 30D To add two 3 x 2 matrices you add the corresponding en tries: Definition 30E (M atrix Subtraction) The difference of two matrices of the same size is defined by entry wise subtraction. More precisely, two matrices A E F mXn and B E F mXn determine a third matrix A —B e F mXn by the rule entry ij{A -B) = entry0·(Λ) -entry^B) for i = 1, 2 ,... ,m, j = 1, 2 ,... ,n. 2.2 Additive Operations on Matrices 31 Exam ple 31A To subtract two 3 x 2 matrices you subtract the corre sponding entries: Definition 31B The m x n zero matrix is the element of F mXn whose entries are all 0. It is denoted by 0mXn or simply 0 if the size can be understood from the context: entry ^(0) = entryi:)(0mxn) = 0 for i = 1, 2 ,..., ra, j = 1, 2 ,..., n. Exam ple 31C Here’s the 2 x 3 zero matrix; > Question 31D Does 02x3 = 03X2? Definition 31E (Scalar M ultiplication) The scalar product of a number and a matrix is defined by entrywise multiplication.
Index pages curate the most relevant extracts from our library of academic textbooks. They’ve been created using an in-house natural language model (NLM), each adding context and meaning to key research topics.









