Skip to content

Latest commit

 

History

History
43 lines (27 loc) · 1.7 KB

File metadata and controls

43 lines (27 loc) · 1.7 KB

Scalar Multiplication

This program takes a matrix as input along with a number, and calculates the matrix resulting from multiplying each element of the matrix by the given number.

Usage

  1. Run the program.
  2. Enter the number of rows and columns for the matrix.
  3. Enter the elements of the matrix.
  4. The entered matrix will be displayed.
  5. Enter the number to multiply the matrix.
  6. The resulting matrix after multiplication will be displayed.

Example

To perform scalar multiplication, it is enough to multiply that number in each matrix and form a new matrix with the results. A number that is multiplied by a matrix is ​​called a "scalar". Multiplication of a scalar number in a matrix is ​​also called scalar multiplication.

Suppose we have the following matrix:

                                A =   [[ 2 , 4 ],
                                          [ 1 , 3 ]]

And we want to multiply it by the number 3: ===> Scalar number = 3

The calculation would be as follows:

                                3.A =  3. [[ 2 , 4 ],    =    [[ 3x2 , 3x4 ],
                                           [ 1 , 3 ]]          [ 3x1 , 3x3 ]]          

The resulting matrix after multiplication would be:

                                Scalar matrix   =   [[ 6 , 12 ],
                                                     [ 3 , 9 ]]

References

  1. Wikipedia.org. "Scalar multiplication."

  2. geeksforgeeks.org. "Program for scalar multiplication of a matrix."