2

so I have 2 vectors. How do I manipulate them so I end up with the vector of the same size which elements are a product of the corresponding elements of the two vectors. How would I do that for an arbitrary number of vectors? Thanks!

  • What do you mean by the same size? – Mikasa Feb 21 '13 at 13:37
  • Your question is unclear. Do you mean how you do it numerically? – yohBS Feb 21 '13 at 13:41
  • hi, sorry for lack of clarity - I'll try to rephrase it(I'm not a math major). Let's say I have 2 2x1 vectors - I'd like to use matrix multiplication to arrive at a 2x1 vector which elements would be a product of the corresponding elements in the 1st two vectors. – szczepan Feb 21 '13 at 13:55

2 Answers2

1

My interpretation of the question:

If you have vectors: $$\vec a = \langle a_1, a_2, \ldots, a_n\rangle$$ $$\vec b = \langle b_1, b_2, \ldots, b_n\rangle$$

How do you create the vector below? $$\vec c = \langle a_1b_1, a_2b_2, \ldots, a_nb_n\rangle$$

This is the exact definition of element-wise multiplication, which is actually a defined operation. See this question (and those it is linked to) for more information: Symbol for elementwise multiplication of vectors

EDIT: It appears this is also called the Hadamard product.

apnorton
  • 17,706
1

Let $v=(a_{11},a_{12},...a_{1n})_{1\times n}$ and if we want to have what you are looking for (the product of the correspondence elements), so another vector should have the form $w=(b_{i1})_{1}^{n}$.

Mikasa
  • 67,374
  • I see you shortened your "user name", Babak S. Can you guess my first name: A + M + "WHY"? – amWhy Feb 21 '13 at 13:58
  • @amWhy: Yes it is a fun. I hope it has not violated the rules here. Let me see..... A maybe is Arthur. M maybe Micheal... It is like a system of 4 unknowns and just one equation. Hard... – Mikasa Feb 21 '13 at 14:06
  • @amWhy: Eureka! Amy. Right? – Mikasa Feb 21 '13 at 14:13