Saltar al contenido principal
Library homepage
 

Text Color

Text Size

 

Margin Size

 

Font Type

Enable Dyslexic Font
LibreTexts Español

11.2: Multiplicar Matriz

( \newcommand{\kernel}{\mathrm{null}\,}\)

Lea la Sección 10.1 del libro de álgebra lineal aplicada de Stephen Boyd y Lieven Vandenberghe que cubre la Multiplicación de Matrices. Aquí hay una revisión rápida:

Dos matricesA y seB pueden multiplicar juntas si y sólo si sus “dimensiones internas” son las mismas,A es decir, esn×d yB esd×m (tenga en cuenta que las columnas deA y las filas deB son ambasd). La multiplicación de estas dos matrices da como resultado una tercera matrizC con la dimensión den×m. Tenga en cuenta queC tiene la misma primera dimensión queA y la misma segunda dimensión queB. es decirn×m.

El elemento (i,j) enC es el producto punto de la filai th deA y laj th columna deB.

La filai th deA es:

[ai1,ai2,,aid],

y la columnaj th deB es:

\ [\ begin {split}
\ left [
\ begin {matrix}
b_ {1j}\\
b_ {2j}\\
\ vdots\\
b_ {dj}
\ end {matrix}
\ derecha]
\ end {split}\ nonumber\]

Entonces, el producto punto de estos dos vectores es:

cij=ai1b1j+ai2b2j++aidbdj

Considera el2×2 ejemplo simple a continuación:

\ [\ begin {split}
\ left [
\ begin {matrix}
a & b\\
c & d
\ end {matrix}
\ right]
\ left [
\ begin {matrix}
w & x\\
y & z
\ end {matrix}
\ right]
=
\ left [
\ begin {matrix}
aw+by & ax+bz\\
cw + dy & cx + dz
\ end {matrix}
\ right]
\ end {split}\ nonumber\]

Hagamos un ejemplo usando numpy y mostremos los resultados usando sympy:

Login with LibreOne to run this code cell interactively.

If you have already signed in, please refresh the page.

import numpy as np
import sympy as sym
sym.init_printing(use_unicode=True) # Trick to make matrixes look nice in jupyter
import numpy as np
import sympy as sym
sym.init_printing(use_unicode=True) # Trick to make matrixes look nice in jupyter

Login with LibreOne to run this code cell interactively.

If you have already signed in, please refresh the page.

A = np.matrix([[1,1], [2,2]])
sym.Matrix(A)
# 'Run' this cell to see the output
A = np.matrix([[1,1], [2,2]])
sym.Matrix(A)
# 'Run' this cell to see the output

Login with LibreOne to run this code cell interactively.

If you have already signed in, please refresh the page.

B = np.matrix([[3,4], [3,4]])
sym.Matrix(B)
# 'Run' this cell to see the output
B = np.matrix([[3,4], [3,4]])
sym.Matrix(B)
# 'Run' this cell to see the output

Login with LibreOne to run this code cell interactively.

If you have already signed in, please refresh the page.

sym.Matrix(A*B)
# 'Run' this cell to see the output
sym.Matrix(A*B)
# 'Run' this cell to see the output
Hacer esto

Dadas dos matrices;A yB, mostrar que el orden importa al hacer una matriz multiplicar. Es decir, en general,ABBA. Muestra esto con un ejemplo usando dos3×3 matrices y numpy.

Login with LibreOne to run this code cell interactively.

If you have already signed in, please refresh the page.

# Put your code here.
# Put your code here.

Ahora considere el siguiente conjunto de ecuaciones lineales:

3x13x2+9x3= 24

2x12x2+7x3= 17

x1+2x24x3=11

Normalmente escribimos esto en la siguiente forma:

\ [\ begin {split}
\ left [
\ begin {matrix}
3 & -3 & 9\\
2 & -2 & 7\\
-1 & 2 & 2 & -4
\ end {matrix}
\ right]
\ left [
\ begin {matrix}
x_1\\
x_2\\
x_3
\ final {matriz}
\ derecha]
=
\ izquierda [
\ comenzar {matriz}
24\\
17\
-11
\ final {matriz}
\ derecha]
\ end {split}\ nonumber\]

Observe cómo hacer la multiplicación matricial resulta de nuevo en el sistema original de ecuaciones. Si renombramos las tres matrices de arriba aAx,,x yb (note yb son minúsculas porque son vectores de columna) entonces obtenemos la ecuación principal para esta clase, que es:

Ax=b

Tenga en cuenta que la información sobre la ecuación no cambia cuando cambia de formato. Por ejemplo, el formato de ecuación, el formato incrementado y elAx=b formato contienen la misma información. Sin embargo, utilizamos los diferentes formatos para diferentes aplicaciones. Considere la función numpy.linalg.solve que asume el formatoAx=b

Login with LibreOne to run this code cell interactively.

If you have already signed in, please refresh the page.

A = np.matrix([[3, -3,9], [2, -2, 7], [-1, 2, -4]])
sym.Matrix(A)
# 'Run' this cell to see the output
A = np.matrix([[3, -3,9], [2, -2, 7], [-1, 2, -4]])
sym.Matrix(A)
# 'Run' this cell to see the output

Login with LibreOne to run this code cell interactively.

If you have already signed in, please refresh the page.

b = np.matrix([[24], [17], [-11]])
sym.Matrix(b)
# 'Run' this cell to see the output
b = np.matrix([[24], [17], [-11]])
sym.Matrix(b)
# 'Run' this cell to see the output

Login with LibreOne to run this code cell interactively.

If you have already signed in, please refresh the page.

#Calculate answer to x using numpy
x = np.linalg.solve(A,b)
sym.Matrix(x)
# 'Run' this cell to see the output
#Calculate answer to x using numpy
x = np.linalg.solve(A,b)
sym.Matrix(x)
# 'Run' this cell to see the output
Pregunta

¿Cuál es el tamaño de la matriz resultante de multiplicar una10×40 matriz por una40×3 matriz?


This page titled 11.2: Multiplicar Matriz is shared under a CC BY-NC 4.0 license and was authored, remixed, and/or curated by Dirk Colbry via source content that was edited to the style and standards of the LibreTexts platform.

Support Center

How can we help?