Home
Random example
Search
Applications
Chemistry
Economy
Famous theorems
Geography
Physics
Sports
Test
Assessment
Calculus
3D
Applied calculus
Basic calculus
Differential equations
Function plotting
Implicit plotting
Sequences and series
Charts and data
Charts
Statistics
Curves
Interpolation
Intersection, Union, Difference
Lindenmayer Systems
Splines
Geometry
3D
Analytic
Euclidean
Basic constructions
Mappings
Non-Euclidean
Projective
Symmetry
Technical
Accessibility
Animation
Roulettes
Board options
First steps
Images
JSXGraph objects
Arcs and angles
Axes
Circles
Glider
Groups
Lines and arrows
Point
Polygons
Slider
Turtle
Vectors
JessieCode
Texts
Transformations
Video
jsxgraph.org
JSXGraph logo
JSXGraph
JSXGraph share

Share

Matrix multiplication
Show plain example
QR code
<iframe 
    src="https://jsxgraph.org/share/iframe/matrix-multiplication" 
    style="border: 1px solid black; overflow: hidden; width: 550px; aspect-ratio: 55 / 65;" 
    name="JSXGraph example: Matrix multiplication" 
    allowfullscreen
></iframe>
This code has to
<div id="board-0-wrapper" class="jxgbox-wrapper " style="width: 100%; ">
   <div id="board-0" class="jxgbox" style="aspect-ratio: 1 / 1; width: 75%;" data-ar="1 / 1"></div>
</div>
<div id="board-1-wrapper" class="jxgbox-wrapper " style="width: 100%; ">
   <div id="board-1" class="jxgbox" style="aspect-ratio: 1 / 1; width: 75%;" data-ar="1 / 1"></div>
</div>

<script type = "text/javascript"> 
    /*
    This example is licensed under a 
    Creative Commons Attribution ShareAlike 4.0 International License.
    https://creativecommons.org/licenses/by-sa/4.0/
    
    Please note you have to mention 
    The Center of Mobile Learning with Digital Technology
    in the credits.
    */
    
    const BOARDID0 = 'board-0';
    const BOARDID1 = 'board-1';
    const BOARDID = BOARDID0;

      var board1 = JXG.JSXGraph.initBoard(BOARDID0, { boundingbox: [-7.5, 7.5, 12.5, -7.5], axis: true });
      var a = board1.create('slider', [[-5, -2], [5, -2], [-5, 1, 5]], { name: 'a', snapWidth: 0.1 });
      var b = board1.create('slider', [[-5, -3], [5, -3], [-5, 0, 5]], { name: 'b', snapWidth: 0.1 });
      var c = board1.create('slider', [[-5, -4], [5, -4], [-5, 0, 5]], { name: 'c', snapWidth: 0.1 });
      var d = board1.create('slider', [[-5, -5], [5, -5], [-5, 1, 5]], { name: 'd', snapWidth: 0.1 });
    
      var v = board1.create('point', [2, 2], { size: 3, name: 'v' });
      var w = board1.create('point', [-2, 1], { size: 3, name: 'w' });
      var va = board1.create('arrow', [[0, 0], v]);
      var wa = board1.create('arrow', [[0, 0], w]);
    
      var board2 = JXG.JSXGraph.initBoard(BOARDID1, { boundingbox: [-7.5, 7.5, 12.5, -7.5], axis: true });
      board1.addChild(board2);
    
      var v2 = board2.create('point', [
           () => a.Value() * v.X() + b.Value() * v.Y(),
           () => c.Value() * v.X() + d.Value() * v.Y()], 
           { face: '[]', size: 2, name: "v'" });
      var w2 = board2.create('point', [
           () => a.Value() * w.X() + b.Value() * w.Y(),
           () => c.Value() * w.X() + d.Value() * w.Y()], 
           { face: '[]', size: 2, name: "w'" });
      var va2 = board2.create('segment', [[0, 0], v2], { lastArrow: true });
      var wa2 = board2.create('segment', [[0, 0], w2], { lastArrow: true });
      
      board2.create('text', [-6, -2, () => '|' + (a.Value()).toFixed(2) + ' ' + (b.Value()).toFixed(2) +
              '|' + '<br>' + '|' + (c.Value()).toFixed(2) + ' ' + (d.Value()).toFixed(2) + '|']);
    
      // board2.create('text', [-6, 5, function() { return '\\begin{pmatrix}' + (a.Value()).toFixed(2) + ' &' + (b.Value()).toFixed(2) + '\\\\' +
      //        (c.Value()).toFixed(2) + '& ' + (d.Value()).toFixed(2) + '\\end{pmatrix}'; }], {useMathjax: true});
      
 </script> 
/*
This example is licensed under a 
Creative Commons Attribution ShareAlike 4.0 International License.
https://creativecommons.org/licenses/by-sa/4.0/

Please note you have to mention 
The Center of Mobile Learning with Digital Technology
in the credits.
*/

const BOARDID0 = 'your_div_id_0'; // Insert your 1st board id here!
const BOARDID1 = 'your_div_id_1'; // Insert your 2nd board id here!

  var board1 = JXG.JSXGraph.initBoard(BOARDID0, { boundingbox: [-7.5, 7.5, 12.5, -7.5], axis: true });
  var a = board1.create('slider', [[-5, -2], [5, -2], [-5, 1, 5]], { name: 'a', snapWidth: 0.1 });
  var b = board1.create('slider', [[-5, -3], [5, -3], [-5, 0, 5]], { name: 'b', snapWidth: 0.1 });
  var c = board1.create('slider', [[-5, -4], [5, -4], [-5, 0, 5]], { name: 'c', snapWidth: 0.1 });
  var d = board1.create('slider', [[-5, -5], [5, -5], [-5, 1, 5]], { name: 'd', snapWidth: 0.1 });

  var v = board1.create('point', [2, 2], { size: 3, name: 'v' });
  var w = board1.create('point', [-2, 1], { size: 3, name: 'w' });
  var va = board1.create('arrow', [[0, 0], v]);
  var wa = board1.create('arrow', [[0, 0], w]);

  var board2 = JXG.JSXGraph.initBoard(BOARDID1, { boundingbox: [-7.5, 7.5, 12.5, -7.5], axis: true });
  board1.addChild(board2);

  var v2 = board2.create('point', [
       () => a.Value() * v.X() + b.Value() * v.Y(),
       () => c.Value() * v.X() + d.Value() * v.Y()], 
       { face: '[]', size: 2, name: "v'" });
  var w2 = board2.create('point', [
       () => a.Value() * w.X() + b.Value() * w.Y(),
       () => c.Value() * w.X() + d.Value() * w.Y()], 
       { face: '[]', size: 2, name: "w'" });
  var va2 = board2.create('segment', [[0, 0], v2], { lastArrow: true });
  var wa2 = board2.create('segment', [[0, 0], w2], { lastArrow: true });
  
  board2.create('text', [-6, -2, () => '|' + (a.Value()).toFixed(2) + ' ' + (b.Value()).toFixed(2) +
          '|' + '<br>' + '|' + (c.Value()).toFixed(2) + ' ' + (d.Value()).toFixed(2) + '|']);

  // board2.create('text', [-6, 5, function() { return '\\begin{pmatrix}' + (a.Value()).toFixed(2) + ' &' + (b.Value()).toFixed(2) + '\\\\' +
  //        (c.Value()).toFixed(2) + '& ' + (d.Value()).toFixed(2) + '\\end{pmatrix}'; }], {useMathjax: true});
  
<jsxgraph width="75%, 75%" aspect-ratio="1 / 1, 1 / 1" numberOfBoards="2" title="Matrix multiplication" description="This construction was copied from JSXGraph examples database: BTW HERE SHOULD BE A GENERATED LINKuseGlobalJS="false">
   /*
   This example is licensed under a 
   Creative Commons Attribution ShareAlike 4.0 International License.
   https://creativecommons.org/licenses/by-sa/4.0/
   
   Please note you have to mention 
   The Center of Mobile Learning with Digital Technology
   in the credits.
   */
   
     var board1 = JXG.JSXGraph.initBoard(BOARDID0, { boundingbox: [-7.5, 7.5, 12.5, -7.5], axis: true });
     var a = board1.create('slider', [[-5, -2], [5, -2], [-5, 1, 5]], { name: 'a', snapWidth: 0.1 });
     var b = board1.create('slider', [[-5, -3], [5, -3], [-5, 0, 5]], { name: 'b', snapWidth: 0.1 });
     var c = board1.create('slider', [[-5, -4], [5, -4], [-5, 0, 5]], { name: 'c', snapWidth: 0.1 });
     var d = board1.create('slider', [[-5, -5], [5, -5], [-5, 1, 5]], { name: 'd', snapWidth: 0.1 });
   
     var v = board1.create('point', [2, 2], { size: 3, name: 'v' });
     var w = board1.create('point', [-2, 1], { size: 3, name: 'w' });
     var va = board1.create('arrow', [[0, 0], v]);
     var wa = board1.create('arrow', [[0, 0], w]);
   
     var board2 = JXG.JSXGraph.initBoard(BOARDID1, { boundingbox: [-7.5, 7.5, 12.5, -7.5], axis: true });
     board1.addChild(board2);
   
     var v2 = board2.create('point', [
          () => a.Value() * v.X() + b.Value() * v.Y(),
          () => c.Value() * v.X() + d.Value() * v.Y()], 
          { face: '[]', size: 2, name: "v'" });
     var w2 = board2.create('point', [
          () => a.Value() * w.X() + b.Value() * w.Y(),
          () => c.Value() * w.X() + d.Value() * w.Y()], 
          { face: '[]', size: 2, name: "w'" });
     var va2 = board2.create('segment', [[0, 0], v2], { lastArrow: true });
     var wa2 = board2.create('segment', [[0, 0], w2], { lastArrow: true });
     
     board2.create('text', [-6, -2, () => '|' + (a.Value()).toFixed(2) + ' ' + (b.Value()).toFixed(2) +
             '|' + '<br>' + '|' + (c.Value()).toFixed(2) + ' ' + (d.Value()).toFixed(2) + '|']);
   
     // board2.create('text', [-6, 5, function() { return '\\begin{pmatrix}' + (a.Value()).toFixed(2) + ' &' + (b.Value()).toFixed(2) + '\\\\' +
     //        (c.Value()).toFixed(2) + '& ' + (d.Value()).toFixed(2) + '\\end{pmatrix}'; }], {useMathjax: true});
     
</jsxgraph>

Matrix multiplication

Mappings
Vectors
On the first board, two vectors are shown. Sliders control the entries of a 2×2 transformation matrix. On the second board, the transformed vectors appear, updating in real time to visualize how the matrix manipulates their direction and scale.
Have also a look at the examples
  • Matrix multiplication II
Web references
  • Matrix Multiplication
// Define the ids of your boards in BOARDID0, BOARDID1,...

  var board1 = JXG.JSXGraph.initBoard(BOARDID0, { boundingbox: [-7.5, 7.5, 12.5, -7.5], axis: true });
  var a = board1.create('slider', [[-5, -2], [5, -2], [-5, 1, 5]], { name: 'a', snapWidth: 0.1 });
  var b = board1.create('slider', [[-5, -3], [5, -3], [-5, 0, 5]], { name: 'b', snapWidth: 0.1 });
  var c = board1.create('slider', [[-5, -4], [5, -4], [-5, 0, 5]], { name: 'c', snapWidth: 0.1 });
  var d = board1.create('slider', [[-5, -5], [5, -5], [-5, 1, 5]], { name: 'd', snapWidth: 0.1 });

  var v = board1.create('point', [2, 2], { size: 3, name: 'v' });
  var w = board1.create('point', [-2, 1], { size: 3, name: 'w' });
  var va = board1.create('arrow', [[0, 0], v]);
  var wa = board1.create('arrow', [[0, 0], w]);

  var board2 = JXG.JSXGraph.initBoard(BOARDID1, { boundingbox: [-7.5, 7.5, 12.5, -7.5], axis: true });
  board1.addChild(board2);

  var v2 = board2.create('point', [
       () => a.Value() * v.X() + b.Value() * v.Y(),
       () => c.Value() * v.X() + d.Value() * v.Y()], 
       { face: '[]', size: 2, name: "v'" });
  var w2 = board2.create('point', [
       () => a.Value() * w.X() + b.Value() * w.Y(),
       () => c.Value() * w.X() + d.Value() * w.Y()], 
       { face: '[]', size: 2, name: "w'" });
  var va2 = board2.create('segment', [[0, 0], v2], { lastArrow: true });
  var wa2 = board2.create('segment', [[0, 0], w2], { lastArrow: true });
  
  board2.create('text', [-6, -2, () => '|' + (a.Value()).toFixed(2) + ' ' + (b.Value()).toFixed(2) +
          '|' + '<br>' + '|' + (c.Value()).toFixed(2) + ' ' + (d.Value()).toFixed(2) + '|']);

  // board2.create('text', [-6, 5, function() { return '\\begin{pmatrix}' + (a.Value()).toFixed(2) + ' &' + (b.Value()).toFixed(2) + '\\\\' +
  //        (c.Value()).toFixed(2) + '& ' + (d.Value()).toFixed(2) + '\\end{pmatrix}'; }], {useMathjax: true});
  

license

This example is licensed under a Creative Commons Attribution ShareAlike 4.0 International License.
Please note you have to mention The Center of Mobile Learning with Digital Technology in the credits.