Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1996

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How to mutiply a 3x1 and 1x3 vector

  • To: mathgroup at
  • Subject: [mg3091] Re: How to mutiply a 3x1 and 1x3 vector
  • From: leszek (Leszek Sczaniecki)
  • Date: Wed, 31 Jan 1996 03:03:53 -0500
  • Organization: Wolfram Research, Inc.
  • Sender: owner-wri-mathgroup at

In article <4ekes6$6gj at> snichols at (Stephen Nichols) writes:
> Hi,
> I have another question that I thought would be simple to to in Mathematica.
> I have two vectors A={1,2,3} and B={3,4,5}.  How do I multiple them together
> to get a 3x3 matrix.  A . B gives me a scalar result.  Mma seems to always
> treat the first one as a row vector and the second as a column vector.  I
> need it to do the opposite.  Treat the first as a column vector and the second
> as a row vector.  Any ideas?
> thanks,

It seem to me that the best way to distinguish between row and column vectors is to write  
them explicitly in matrix form.
	{{a}, {b}, {c}} is a column vector.
	{{x, y, z}} is a row vector.
	{{a}, {b}, {c}}.{{x, y, z}} is a 3x3 matrix:
	{{x, y, z}}.{{a}, {b}, {c}} is 1x1 matrix (as oppose to a scalar).

In[1]:= vector = {{a}, {b}, {c}}             
Out[1]= {{a}, {b}, {c}}

In[2]:= MatrixForm[vector]
Out[2]//MatrixForm= a



In[3]:= covector = {{x, y, z}}
Out[3]= {{x, y, z}}

In[4]:= MatrixForm[covector]
Out[4]//MatrixForm= x   y   z

In[5]:= vector.covector
Out[5]= {{a x, a y, a z}, {b x, b y, b z}, {c x, c y, c z}}

In[6]:= MatrixForm[%]
Out[6]//MatrixForm= a x   a y   a z

                    b x   b y   b z

                    c x   c y   c z

In[7]:= covector.vector
Out[7]= {{a x + b y + c z}}

In[8]:= MatrixForm[%]
Out[8]//MatrixForm= a x + b y + c z

There is no problem to transfer lists into vectors or covectors. Here are obvious  

ToVector[l_List]:= List /@ l
ToCovector[l_List]:= {l}




  • Prev by Date: [Q] Plot in a Plot
  • Next by Date: Re: Two questions regarding command line interface
  • Previous by thread: Re: How to mutiply a 3x1 and 1x3 vector
  • Next by thread: Re: How to mutiply a 3x1 and 1x3 vector