This tutorial tells about how to write matrix expressions in LibreOffice Math and Writer, by examples. This tutorial is a continuation from the previous LibreOffice Math Introduction article. Here, we provide 12 examples with source code (markup code) for each of them. And we collect the codes summary at the end. We hope this helps you a lot.

Tool Needed



When you open LibreOffice Math, see Elements Toolbox > visit Formats > select Matrix.

For First Timers


Result:

This is the sample result, the simplest form of matrix:



Source code: 

This is the source code (markup code) of that matrix.


matrix{a # b ## c # c}


LibreOffice Math: 

You may either using LibreOffice Math to write that matrix expression like this ...




LibreOffice Writer: 

... or write that matrix expression directly into LibreOffice Writer by visiting menu Insert > Object > Formula.




Example 1


Result: 


Source code: 

left ( { matrix{a # b ## c # c} } right ) 

Explanation: 

This code gives the basic matrix a pair of brackets. You may choose it from Brackets.

Example 2


Result: 

Source code: 

M = left ( { matrix{a_{1,1} # b_{1,2} ## c_{2,1} # d_{2,2}} } right ) 

Explanation:

This code adds subscript coordinate (row, col) to each matrix member.

Example 3


Result:

Source code:

M = left ( { matrix{1 # 2 ## 3 # 4} } right ) 
M = left ( { matrix{-1 # -2 ## -3 # -4} } right )

Explanation:

To write negative numbers, add minus sign right before every number.

Example 4


Result:

Source code:

M = left ( { matrix{{1 over 2} # {1 over 3} ## {1 over 4} # {1 over 5}} } right )

Explanation:

To write division/fraction inside a matrix, use "over" command.

Example 5


Result:

Source code:

M = left ( { matrix{1 # 2 # 3 ## 4 # 5 # 6 ## 7 # 8 # 9} } right ) 
N = left ( {matrix { 1 ## 2 ## 3} } right )

Explanation:

To write (x,y) matrix, pay attention to # and ##, while # indicating same line space, and ## indicating a line break inside a matrix.

Example 6


Result:

Source code:

A + B = {left ( {matrix{ 1 # 2 ## 3 # 4} } right )} + { left ( {matrix{ 5 # 6 ## 7 # 8} } right ) } = { left ( {matrix{6 # 8 ## 10 # 12} } right )}

Explanation:

An example for matrices addition operation.

Example 7


Result:

Source code:

A = left ( {matrix{ a_{11} # a_{12} # dotsaxis  # a_{1n} ## a_{21} # a_{22} # dotsaxis  # a_{2n} ## dotsvert # dotsvert  # dotsdown  # dotsvert  ## a_{m1} # a_{m2} # dotsaxis # a_{mn}} } right )

Explanation:

An example for a matrix with dots members. Pick the dots from Others category.

Example 8 


Result:

Source code:

left ( {matrix{1 # 2 # 3 ## 4 # 5 # 6} } right )^{ T } = left ( {matrix{1 # 4 ## 2 # 5 ## 3 # 6} } right )

Explanation:

To write superscript "T", just add "^" (caret) right between the matrix and the "T".

Example 9


Result:


Source code:

left ( {matrix{a # b # c ## d # e # f} } right ) cdot left( {matrix{u # v ## w # x ## y # z} } right ) = left ( {matrix{au + bw + cy # av + bx + cz ## du + ew + fy # dv + ex + fz} } right )

Explanation:

Another example for matrices equation in an multiplication operation.

Example 10


Result:


Source code:

left ( {matrix{x' ## y'} } right ) = left( {matrix{cos %theta # sin %theta ## -sin %theta # cos %theta} } right ) left( {matrix{x ## y} } right )

Note:

The code to represent theta character is %theta.

Example 11


Result:


Source code:

M = left ( { matrix{ color magenta {1} # color magenta {2} # color magenta {3} ## 4 # 5 # 6 ## 7 # 8 # 9} } right )
N = left ( { matrix{ color magenta {1} # 2 # 3 ## 4 # color magenta {5} # 6 ## 7 # 8 # color magenta {9}} } right )


Explanation:

See the color magenta {} code. You may change the magenta color name into green, blue, red, or yellow.

Example 12


Result: 



Source code:

left ( {matrix{8 # 12 # 3 ## 4 # 4 # 9} } right ) = left ( {matrix{8 # 6x # z-y ## y+1 # 4 # 9} } right )

Explanation: 

Another example about matrices equation.

Codes Summary



  1. matrix{a # b ## c # c}
  2. left ( { matrix{a # b ## c # c} } right )
  3. M = left ( { matrix{a_{1,1} # b_{1,2} ## c_{2,1} # d_{2,2}} } right )
  4. M = left ( { matrix{1 # 2 ## 3 # 4} } right ) 
    M = left ( { matrix{-1 # -2 ## -3 # -4} } right )
  5. M = left ( { matrix{{1 over 2} # {1 over 3} ## {1 over 4} # {1 over 5}} } right )
  6. M = left ( { matrix{1 # 2 # 3 ## 4 # 5 # 6 ## 7 # 8 # 9} } right ) 
    N = left ( {matrix { 1 ## 2 ## 3} } right )
  7. A + B = {left ( {matrix{ 1 # 2 ## 3 # 4} } right )} + { left ( {matrix{ 5 # 6 ## 7 # 8} } right ) } = { left ( {matrix{6 # 8 ## 10 # 12} } right )}
  8. A = left ( {matrix{ a_{11} # a_{12} # dotsaxis  # a_{1n} ## a_{21} # a_{22} # dotsaxis  # a_{2n} ## dotsvert # dotsvert  # dotsdown  # dotsvert  ## a_{m1} # a_{m2} # dotsaxis # a_{mn}} } right )
  9. left ( {matrix{1 # 2 # 3 ## 4 # 5 # 6} } right )^{ T } = left ( {matrix{1 # 4 ## 2 # 5 ## 3 # 6} } right )
  10. left ( {matrix{a # b # c ## d # e # f} } right ) cdot left( {matrix{u # v ## w # x ## y # z} } right ) = left ( {matrix{au + bw + cy # av + bx + cz ## du + ew + fy # dv + ex + fz} } right )
  11. left ( {matrix{x' ## y'} } right ) = left( {matrix{cos %theta # sin %theta ## -sin %theta # cos %theta} } right ) left( {matrix{x ## y} } right ) 
  12. left ( {matrix{8 # 12 # 3 ## 4 # 4 # 9} } right ) = left ( {matrix{8 # 6x # z-y ## y+1 # 4 # 9} } right )

 

References



, , , ,