<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
  <channel>
    <title>MaplePrimes - answers and comments on Question, matrix multiplication error</title>
    <link>http://www.mapleprimes.com/questions/130353-Matrix-Multiplication-Error</link>
    <language>en-us</language>
    <copyright>2026 Maplesoft, A Division of Waterloo Maple Inc.</copyright>
    <generator>Maplesoft Document System</generator>
    <lastBuildDate>Fri, 12 Jun 2026 04:44:25 GMT</lastBuildDate>
    <pubDate>Fri, 12 Jun 2026 04:44:25 GMT</pubDate>
    <itunes:subtitle />
    <itunes:summary />
    <description>The latest answers and comments added to the Question, matrix multiplication error</description>
    <image>
      <url>http://www.mapleprimes.com/images/mapleprimeswhite.jpg</url>
      <title>MaplePrimes - answers and comments on Question, matrix multiplication error</title>
      <link>http://www.mapleprimes.com/questions/130353-Matrix-Multiplication-Error</link>
    </image>
    <item>
      <title>lists and Matrices</title>
      <link>http://www.mapleprimes.com/questions/130353-Matrix-Multiplication-Error?ref=Feed:MaplePrimes:matrix multiplication error:Comments#answer130363</link>
      <itunes:summary>&lt;p&gt;Judging by (what I hope is) text representation of your output, it looks like you might have accidentally created your Matrices with the wrong orientations. Doing A.B for A a 2x1 Matrix and B a 1x2 Matrix will compute an outer product and result in a 2x2 Matrix.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This works for me&lt;/p&gt;
&lt;pre&gt;&amp;gt; restart:

&amp;gt; b2 := zeta -&amp;gt; Matrix([[-y(zeta)], [-x(zeta)]])^%T:

&amp;gt; N0 := zeta -&amp;gt; Matrix([[(1-zeta)], [(zeta)]]):

&amp;gt; b2(zeta); # 1x2

                            [-y(zeta)  -x(zeta)]

&amp;gt; N0(zeta); # 2x1

                                 [1 - zeta]
                                 [        ]
                                 [  zeta  ]

&amp;gt; b2(zeta) . N0(zeta); # 1x1

                    [-y(zeta) (1 - zeta) - x(zeta) zeta]
&lt;/pre&gt;
&lt;p&gt;I don't understand why you're creating b2, N0, and B2 as operators instead of expressions, if you're just going to use them by applying them to the name zeta. It's also a bit unclear whether you mean -x*zeta or -x(zeta) a function application. And did you make a typographic error, using `be` instead of `b2`?&lt;/p&gt;
&lt;p&gt;It looks like you might have accidentally done this. Notice the difference in the bracketing inside the calls to the Matrix constructor.&lt;/p&gt;
&lt;pre&gt;&amp;gt; restart:

&amp;gt; b2 := zeta -&amp;gt; Matrix([[-y(zeta), -x(zeta)]])^%T;

                                                      %T
                    b2 := zeta -&amp;gt; [-y(zeta)  -x(zeta)]  

&amp;gt; N0 := zeta -&amp;gt; Matrix([[(1-zeta), (zeta)]]);

                       N0 := zeta -&amp;gt; [1 - zeta  zeta]

&amp;gt; b2(zeta); # 2x1

                                 [-y(zeta)]
                                 [        ]
                                 [-x(zeta)]

&amp;gt; N0(zeta); # 1x2

                              [1 - zeta  zeta]

&amp;gt; b2(zeta) . N0(zeta); # 2x2

                    [-y(zeta) (1 - zeta)  -y(zeta) zeta]
                    [                                  ]
                    [-x(zeta) (1 - zeta)  -x(zeta) zeta]
&lt;/pre&gt;</itunes:summary>
      <description>&lt;p&gt;Judging by (what I hope is) text representation of your output, it looks like you might have accidentally created your Matrices with the wrong orientations. Doing A.B for A a 2x1 Matrix and B a 1x2 Matrix will compute an outer product and result in a 2x2 Matrix.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This works for me&lt;/p&gt;
&lt;pre&gt;&amp;gt; restart:

&amp;gt; b2 := zeta -&amp;gt; Matrix([[-y(zeta)], [-x(zeta)]])^%T:

&amp;gt; N0 := zeta -&amp;gt; Matrix([[(1-zeta)], [(zeta)]]):

&amp;gt; b2(zeta); # 1x2

                            [-y(zeta)  -x(zeta)]

&amp;gt; N0(zeta); # 2x1

                                 [1 - zeta]
                                 [        ]
                                 [  zeta  ]

&amp;gt; b2(zeta) . N0(zeta); # 1x1

                    [-y(zeta) (1 - zeta) - x(zeta) zeta]
&lt;/pre&gt;
&lt;p&gt;I don't understand why you're creating b2, N0, and B2 as operators instead of expressions, if you're just going to use them by applying them to the name zeta. It's also a bit unclear whether you mean -x*zeta or -x(zeta) a function application. And did you make a typographic error, using `be` instead of `b2`?&lt;/p&gt;
&lt;p&gt;It looks like you might have accidentally done this. Notice the difference in the bracketing inside the calls to the Matrix constructor.&lt;/p&gt;
&lt;pre&gt;&amp;gt; restart:

&amp;gt; b2 := zeta -&amp;gt; Matrix([[-y(zeta), -x(zeta)]])^%T;

                                                      %T
                    b2 := zeta -&amp;gt; [-y(zeta)  -x(zeta)]  

&amp;gt; N0 := zeta -&amp;gt; Matrix([[(1-zeta), (zeta)]]);

                       N0 := zeta -&amp;gt; [1 - zeta  zeta]

&amp;gt; b2(zeta); # 2x1

                                 [-y(zeta)]
                                 [        ]
                                 [-x(zeta)]

&amp;gt; N0(zeta); # 1x2

                              [1 - zeta  zeta]

&amp;gt; b2(zeta) . N0(zeta); # 2x2

                    [-y(zeta) (1 - zeta)  -y(zeta) zeta]
                    [                                  ]
                    [-x(zeta) (1 - zeta)  -x(zeta) zeta]
&lt;/pre&gt;</description>
      <guid>130363</guid>
      <pubDate>Mon, 06 Feb 2012 08:42:34 Z</pubDate>
      <itunes:author>pagan</itunes:author>
      <author>pagan</author>
    </item>
    <item>
      <title>Thank you very much for your help. I needed</title>
      <link>http://www.mapleprimes.com/questions/130353-Matrix-Multiplication-Error?ref=Feed:MaplePrimes:matrix multiplication error:Comments#comment130381</link>
      <itunes:summary>&lt;p&gt;Thank you very much for your help. I needed the first scenario, i left it as an operator because i need to differentiate and integrate it later on.&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;Thank you very much for your help. I needed the first scenario, i left it as an operator because i need to differentiate and integrate it later on.&lt;/p&gt;</description>
      <guid>130381</guid>
      <pubDate>Mon, 06 Feb 2012 22:34:10 Z</pubDate>
      <itunes:author>serena88</itunes:author>
      <author>serena88</author>
    </item>
    <item>
      <title>Add on question to Matrix dot product</title>
      <link>http://www.mapleprimes.com/questions/130353-Matrix-Multiplication-Error?ref=Feed:MaplePrimes:matrix multiplication error:Comments#comment130661</link>
      <itunes:summary>&lt;p&gt;Hi, I have another add on question regarding the dot product of matrix :&lt;/p&gt;
&lt;p&gt;with(LinearAlgebra):&lt;/p&gt;
&lt;p&gt;A:=Matrix([[3,t,2f],[k,4,w]])&amp;nbsp;&amp;nbsp; ###2x3 matrix&lt;/p&gt;
&lt;p&gt;B:=Matrix([[g],[h],[m]])&amp;nbsp;&amp;nbsp; ###3x1 matrix&lt;/p&gt;
&lt;p&gt;Method 1 : why can I not get "DotProduct(A,B)"?&lt;/p&gt;
&lt;p&gt;Method 2: but when I put down "A.B", it gives me the answer.&lt;/p&gt;
&lt;p&gt;I try again with C:=Matrix([[a,b]])&amp;nbsp;&amp;nbsp; ###1x2 matrix&lt;/p&gt;
&lt;p&gt;I then put down "B.C" (not possible case) which gives me a wrong answer, hence, I cannot use the second method. Could you let me know how do I make the Method 1 work please?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;Hi, I have another add on question regarding the dot product of matrix :&lt;/p&gt;
&lt;p&gt;with(LinearAlgebra):&lt;/p&gt;
&lt;p&gt;A:=Matrix([[3,t,2f],[k,4,w]])&amp;nbsp;&amp;nbsp; ###2x3 matrix&lt;/p&gt;
&lt;p&gt;B:=Matrix([[g],[h],[m]])&amp;nbsp;&amp;nbsp; ###3x1 matrix&lt;/p&gt;
&lt;p&gt;Method 1 : why can I not get "DotProduct(A,B)"?&lt;/p&gt;
&lt;p&gt;Method 2: but when I put down "A.B", it gives me the answer.&lt;/p&gt;
&lt;p&gt;I try again with C:=Matrix([[a,b]])&amp;nbsp;&amp;nbsp; ###1x2 matrix&lt;/p&gt;
&lt;p&gt;I then put down "B.C" (not possible case) which gives me a wrong answer, hence, I cannot use the second method. Could you let me know how do I make the Method 1 work please?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description>
      <guid>130661</guid>
      <pubDate>Tue, 14 Feb 2012 18:26:53 Z</pubDate>
      <itunes:author>serena88</itunes:author>
      <author>serena88</author>
    </item>
    <item>
      <title>Two answers.</title>
      <link>http://www.mapleprimes.com/questions/130353-Matrix-Multiplication-Error?ref=Feed:MaplePrimes:matrix multiplication error:Comments#comment131113</link>
      <itunes:summary>&lt;p&gt;&lt;a href="http://www.mapleprimes.com/questions/130353-Matrix-Multiplication-Error#comment130661"&gt;@serena88&lt;/a&gt;: As to your first question / method, &lt;a href="http://www.maplesoft.com/support/help/view.aspx?path=LinearAlgebra/DotProduct"&gt;?LinearAlgebra:-DotProduct&lt;/a&gt; works only on pairs of Vectors, not on Matrices. It is meant to represent the inner product on real or complex vector spaces. If the product you're trying to compute involves Matrices, use . (the dot), as you found already, or &lt;a href="http://www.maplesoft.com/support/help/view.aspx?path=LinearAlgebra/Multiply"&gt;?LinearAlgebra:-Multiply&lt;/a&gt; (which does the same thing, I think).&lt;/p&gt;
&lt;p&gt;As to your second question: actually, B . C is well defined: B is a 3x1 Matrix and C a 1x2 Matrix, so you can multiply them to obtain a 3x2 Matrix (since &lt;em&gt;n&lt;/em&gt;x&lt;em&gt;k&lt;/em&gt; and &lt;em&gt;k&lt;/em&gt;x&lt;em&gt;m&lt;/em&gt; matrices can be multiplied for any &lt;em&gt;n, k, m&lt;/em&gt; to obtain &lt;em&gt;n&lt;/em&gt;x&lt;em&gt;m&lt;/em&gt; matrices). If you would use, say, &lt;em&gt;C&lt;/em&gt;^+ (a 2x1 Matrix) instead of &lt;em&gt;C&lt;/em&gt;, then Maple would complain.&lt;/p&gt;
&lt;p&gt;Hope this helps,&lt;/p&gt;
&lt;p&gt;Erik Postma&lt;br&gt;Maplesoft.&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;&lt;a href="http://www.mapleprimes.com/questions/130353-Matrix-Multiplication-Error#comment130661"&gt;@serena88&lt;/a&gt;: As to your first question / method, &lt;a href="http://www.maplesoft.com/support/help/view.aspx?path=LinearAlgebra/DotProduct"&gt;?LinearAlgebra:-DotProduct&lt;/a&gt; works only on pairs of Vectors, not on Matrices. It is meant to represent the inner product on real or complex vector spaces. If the product you're trying to compute involves Matrices, use . (the dot), as you found already, or &lt;a href="http://www.maplesoft.com/support/help/view.aspx?path=LinearAlgebra/Multiply"&gt;?LinearAlgebra:-Multiply&lt;/a&gt; (which does the same thing, I think).&lt;/p&gt;
&lt;p&gt;As to your second question: actually, B . C is well defined: B is a 3x1 Matrix and C a 1x2 Matrix, so you can multiply them to obtain a 3x2 Matrix (since &lt;em&gt;n&lt;/em&gt;x&lt;em&gt;k&lt;/em&gt; and &lt;em&gt;k&lt;/em&gt;x&lt;em&gt;m&lt;/em&gt; matrices can be multiplied for any &lt;em&gt;n, k, m&lt;/em&gt; to obtain &lt;em&gt;n&lt;/em&gt;x&lt;em&gt;m&lt;/em&gt; matrices). If you would use, say, &lt;em&gt;C&lt;/em&gt;^+ (a 2x1 Matrix) instead of &lt;em&gt;C&lt;/em&gt;, then Maple would complain.&lt;/p&gt;
&lt;p&gt;Hope this helps,&lt;/p&gt;
&lt;p&gt;Erik Postma&lt;br&gt;Maplesoft.&lt;/p&gt;</description>
      <guid>131113</guid>
      <pubDate>Thu, 23 Feb 2012 23:43:28 Z</pubDate>
      <itunes:author>epostma</itunes:author>
      <author>epostma</author>
    </item>
  </channel>
</rss>