Multiplying Vectors by a Matrix Entry-wise

In summary, the individual entries of matrix c can be multiplied with the corresponding entries of vectors a and b using entry-wise multiplication, but the dimensions of a and b must match the dimensions of c for this to work.
  • #1
jemma
36
0
Hi, this is probably a really simple problem but I'm trying to multiply vectors by a matrix, using entry-wise multiplication.
For example, I want to do something like this:

a = [1 2 3 4]
b = [5 6 7 8]'
c = [1 2 3 4; 5 6 7 8; 9 10 11 12; 13 14 15 16]

d = a.*b.*c

So that d is a 4x4 matrix and for example:

d(1,2) = 1*5*1 (etc.) So that each entry in the first row of d will be multiplied by b(1) and the corresponding a entry. Does this make sense? Anyway, is this possible?

Thanks!
 
Physics news on Phys.org
  • #2
To use entry-wise multiplication the matrix dimensions must be the same, which they are not. a.*b is a 1x4 matrix and c is a 4x4 matrix.
I don't understand your second to last line because you seem to be explaining how to find d(1,2) by describing an operation on d itself.
 
  • #3
Sorry, I meant to say, for example,
d(1,1) = a(1) .* b(1) .* c(1)
and,
d(1,2) = a(2) .* b(1) .* c(2)

I basically want to multiply each entry of every row of 'c' by 'b' then each entry of every column of 'c' by 'a'.
So isn't this possible since the dimentions are different?

I guess just making
a=[1 2 3 4; 1 2 3 4; 1 2 3 4; 1 2 3 4]
and
b=[5 6 7 8; 5 6 7 8; 5 6 7 8; 5 6 7 8]'
Then d = a.*b.*c works OK.
 
Last edited:
  • #4
a = [1 2 3 4]
b = [5 6 7 8]'
c = [1 2 3 4; 5 6 7 8; 9 10 11 12; 13 14 15 16]
b*a.*c
 
  • #5


Hello, this is a great question and it is definitely possible to multiply vectors by a matrix using entry-wise multiplication. This type of multiplication is also known as the Hadamard product and it is a common operation in linear algebra. In your example, you are correctly using the dot product operator (.*), which multiplies each entry in the first row of matrix c by the corresponding entries in vectors a and b. This will result in a 4x4 matrix d, where each entry is the product of the corresponding entries in a, b, and c. This is a useful operation in many applications, such as image processing and signal processing, where you want to apply a transformation to each element in a matrix or vector. It is important to note that entry-wise multiplication is different from matrix multiplication, where the dimensions of the matrices must be compatible. I hope this helps clarify your question and good luck with your project!
 

What is the purpose of multiplying vectors by a matrix entry-wise?

The purpose of multiplying vectors by a matrix entry-wise is to transform the vector into a new vector that is a combination of the original vector's components. This allows for more complex and precise transformations of data.

How does multiplying vectors by a matrix entry-wise differ from regular vector multiplication?

Multiplying vectors by a matrix entry-wise differs from regular vector multiplication because it involves multiplying each component of the vector by a corresponding entry in the matrix, rather than multiplying the vector as a whole by the entire matrix.

What are the benefits of multiplying vectors by a matrix entry-wise?

The benefits of multiplying vectors by a matrix entry-wise include the ability to perform more precise transformations of data, as well as the ability to apply the same transformation to multiple vectors at once.

Can vectors of different dimensions be multiplied by a matrix entry-wise?

Yes, vectors of different dimensions can be multiplied by a matrix entry-wise as long as the number of columns in the matrix matches the number of components in the vector.

How is the result of multiplying a vector by a matrix entry-wise interpreted?

The result of multiplying a vector by a matrix entry-wise is interpreted as a new vector with transformed components. This result can represent a new set of data or a new state of the original data.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
350
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
121
  • Calculus and Beyond Homework Help
Replies
2
Views
380
  • Linear and Abstract Algebra
Replies
6
Views
507
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
2K
  • Calculus and Beyond Homework Help
Replies
2
Views
82
Back
Top