Difference between revisions of "Matrices"

From GeoGebra Manual
Jump to: navigation, search
m (Text replace - "<div class="box info"> 48px|left This page is part of the official manual for print and pdf. For structural reasons normal users can't edit this page. If you found any errors on this page please contact )
(matrix1/ matrix2 added, brief explanation about allowed operations)
Line 1: Line 1:
 
<noinclude>{{Manual Page|version=4.2}}</noinclude>
 
<noinclude>{{Manual Page|version=4.2}}</noinclude>
 
{{objects|general}}
 
{{objects|general}}
GeoGebra also supports matrices, which are represented as a list of lists that contain the rows of the matrix.
+
GeoGebra supports matrices, which are represented as a list of lists that contain the rows of the matrix.
  
{{Example|1=In GeoGebra, <nowiki>{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}</nowiki> represents a 3x3 matrix.}}
+
{{Example|1=In GeoGebra, <nowiki>{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}</nowiki> represents the 3x3 matrix <math>\begin{pmatrix}1&2&3\\ 4&5&6\\ 7&8&9\end{pmatrix}</math>}}
  
 
In order to display nicely a matrix in the Graphic View, using LaTeX formatting, use [[FormulaText]] command.
 
In order to display nicely a matrix in the Graphic View, using LaTeX formatting, use [[FormulaText]] command.
Line 9: Line 9:
  
 
==Matrix Operations==
 
==Matrix Operations==
 +
Matrix operations are then ''operations with lists'', so the following syntaxes produce the described results.
 +
{{Note|1=Some syntaxes can represent operations which are not defined in the same way in the matrices set.}}
  
===Addition and subtraction examples===
+
===Addition and subtraction ===
 
* Matrix1 + Matrix2: Adds the corresponding elements of two compatible matrices.
 
* Matrix1 + Matrix2: Adds the corresponding elements of two compatible matrices.
 
* Matrix1 – Matrix2: Subtracts the corresponding elements of two compatible matrices.
 
* Matrix1 – Matrix2: Subtracts the corresponding elements of two compatible matrices.
  
===Multiplication examples===
+
===Multiplication and division ===
 
* Matrix * Number: Multiplies every element of the matrix by the given number.
 
* Matrix * Number: Multiplies every element of the matrix by the given number.
 
* Matrix1 * Matrix2: Uses matrix multiplication to calculate the resulting matrix.
 
* Matrix1 * Matrix2: Uses matrix multiplication to calculate the resulting matrix.
{{note|The rows of the first and columns of the second matrix need to have the same number of elements.}}
+
: {{note|The rows of the first and columns of the second matrix need to have the same number of elements.}}
{{example|1={{1, 2}, {3, 4}, {5, 6}} * {{1, 2, 3}, {4, 5, 6}} gives you the matrix {{9, 12, 15}, {19, 26, 33}, {29, 40, 51}}.}}
+
: {{example|1={{1, 2}, {3, 4}, {5, 6}} * {{1, 2, 3}, {4, 5, 6}} gives you the matrix {{9, 12, 15}, {19, 26, 33}, {29, 40, 51}}.}}
 
* 2x2 Matrix * Point (or Vector): Multiplies the matrix with the given point/vector and gives you a point as a result.       
 
* 2x2 Matrix * Point (or Vector): Multiplies the matrix with the given point/vector and gives you a point as a result.       
{{example|1={{1, 2}, {3, 4}} * (3, 4) gives you the point A = (11, 25).}}
+
: {{example|1={{1, 2}, {3, 4}} * (3, 4) gives you the point A = (11, 25).}}
 
* 3x3 Matrix * Point (or Vector): Multiplies the matrix with the given point/vector and gives you a point as a result.       
 
* 3x3 Matrix * Point (or Vector): Multiplies the matrix with the given point/vector and gives you a point as a result.       
{{example|1={{1, 2, 3}, {4, 5, 6}, {0, 0, 1}} * (1, 2) gives you the point A = (8, 20).}}   
+
: {{example|1={{1, 2, 3}, {4, 5, 6}, {0, 0, 1}} * (1, 2) gives you the point A = (8, 20).}}   
{{note|1=This is a special case for affine transformations where homogeneous coordinates are used: (x, y, 1) for a point and (x, y, 0) for a vector. This example is therefore equivalent to:  
+
: {{note|1=This is a special case for affine transformations where homogeneous coordinates are used: (x, y, 1) for a point and (x, y, 0) for a vector. This example is therefore equivalent to: <code><nowiki>{{1, 2, 3}, {4, 5, 6}, {0, 0, 1}} * {1, 2, 1}</nowiki></code>.}}
<code><nowiki>{{1, 2, 3}, {4, 5, 6}, {0, 0, 1}} * {1, 2, 1}</nowiki></code>.}}
+
* Matrix1 / Matrix2: Divides each element of Matrix1 by the corresponding element in Matrix2.
 
+
:{{note|1=However, GeoGebra supports the syntax <code><nowiki>Matrix1 * Matrix2 ^(-1)</nowiki></code> .}}
==Other examples==
 
see also section [[Matrix Commands]]
 
  
 +
==Other operations==
 +
The section [[Matrix Commands]] contains the list of all available commands related to matrices, such as:
 
* [[Determinant Command|Determinant]][Matrix]: Calculates the determinant for the given matrix.
 
* [[Determinant Command|Determinant]][Matrix]: Calculates the determinant for the given matrix.
 
* [[Invert Command|Invert]][Matrix]: Inverts the given matrix
 
* [[Invert Command|Invert]][Matrix]: Inverts the given matrix

Revision as of 08:06, 29 August 2013



GeoGebra supports matrices, which are represented as a list of lists that contain the rows of the matrix.

Example: In GeoGebra, {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}} represents the 3x3 matrix \begin{pmatrix}1&2&3\\ 4&5&6\\ 7&8&9\end{pmatrix}


In order to display nicely a matrix in the Graphic View, using LaTeX formatting, use FormulaText command.

Example: In the input bar type FormulaText[{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}] to display the matrix using LaTeX formatting.


Matrix Operations

Matrix operations are then operations with lists, so the following syntaxes produce the described results.

Note: Some syntaxes can represent operations which are not defined in the same way in the matrices set.

Addition and subtraction

  • Matrix1 + Matrix2: Adds the corresponding elements of two compatible matrices.
  • Matrix1 – Matrix2: Subtracts the corresponding elements of two compatible matrices.

Multiplication and division

  • Matrix * Number: Multiplies every element of the matrix by the given number.
  • Matrix1 * Matrix2: Uses matrix multiplication to calculate the resulting matrix.
Note: The rows of the first and columns of the second matrix need to have the same number of elements.
Example: {{1, 2}, {3, 4}, {5, 6}} * {{1, 2, 3}, {4, 5, 6}} gives you the matrix {{9, 12, 15}, {19, 26, 33}, {29, 40, 51}}.
  • 2x2 Matrix * Point (or Vector): Multiplies the matrix with the given point/vector and gives you a point as a result.
Example: {{1, 2}, {3, 4}} * (3, 4) gives you the point A = (11, 25).
  • 3x3 Matrix * Point (or Vector): Multiplies the matrix with the given point/vector and gives you a point as a result.
Example: {{1, 2, 3}, {4, 5, 6}, {0, 0, 1}} * (1, 2) gives you the point A = (8, 20).
Note: This is a special case for affine transformations where homogeneous coordinates are used: (x, y, 1) for a point and (x, y, 0) for a vector. This example is therefore equivalent to: {{1, 2, 3}, {4, 5, 6}, {0, 0, 1}} * {1, 2, 1}.
  • Matrix1 / Matrix2: Divides each element of Matrix1 by the corresponding element in Matrix2.
Note: However, GeoGebra supports the syntax Matrix1 * Matrix2 ^(-1) .

Other operations

The section Matrix Commands contains the list of all available commands related to matrices, such as:

  • Determinant[Matrix]: Calculates the determinant for the given matrix.
  • Invert[Matrix]: Inverts the given matrix
  • Transpose[Matrix]: Transposes the given matrix
  • ApplyMatrix[Matrix,Object]: Apply affine transform given by matrix on object.
  • ReducedRowEchelonForm[Matrix]: Converts the matrix to a reduced row-echelon form


Comments

Note: See the official forum for a more detailed discussion about the multiplication of matrices.
© 2024 International GeoGebra Institute