# Cross product of three vectors

I am following the answer of Jens from following post: How do I simplify a vector expression?

vec /: Cross[vec[x_], HoldPattern[Cross[y__]]] :=


I want to create following identities (I use x to represent \[Cross] for readability):

vec[a]x(vec[b] x vec[c]) = (vec[a] x vec[b]) x vec[c] - (vec[a] x vec[c]) x vec[b]

(vec[a] x vec[b]) x vec[c] = vec[a] x (vec[b] x vec[c]) + (vec[a] x vec[c]) x vec[b]


but unable to make. I tried the following command Map[Cross[Cross[vec[x], #], #] &, Plus[y]] but in product it gives

vec[a]x(vec[b] x vec[c]) = (vec[a] x vec[b]) x vec[b] - (vec[a] x vec[c]) x vec[c]


• First of all you can't input a simple x-character and expect that to be the operator for cross product. Jan 30, 2016 at 13:39
• Hi! I have shared the link of the an answer that I am following. I didn't copy the whole procedure as it might b bulky. I am sharing again here: Answer by Jens . Please look into first answer by Jens
– aly
Jan 30, 2016 at 13:41
• @aly I incorporated your comment into the body of the question, since the x was causing confusion. I think it's fine the way it is, but one thing to keep in mind is that people using the site usually have M running and can copy and paste ugly code into the front end to see it formatted nicely and have the syntax checked. The question is whether having the desired code with proper syntax is helpful to those who are interested in your question. It might seem so to some, I suppose. Jan 30, 2016 at 13:52

To implement your first identity you can use:

vec /: Cross[vec[x_], Cross[vec[y_], vec[z_]]] :=
Cross[Cross[vec@x, vec@y], vec@z] -Cross[Cross[vec@x, vec@z], vec@y]


Resulting in:

In[1] := vec[x]\[Cross](vec[y]\[Cross]vec[z])
Out[1] = (vec[x]\[Cross]vec[y])\[Cross]vec[z] - (vec[x]\[Cross]vec[z])\[Cross]vec[y]


The other identity is implemented similarly

• Instead of Dot it will be cross. I changed it and works fine with me. Thanks gIS
– aly
Jan 30, 2016 at 16:34
• @aly of course! Sorry for the typo, Dot would not even make sense as it generates a scalar.
– glS
Jan 30, 2016 at 16:35
• @gIS: I extended your suggestion and trying to implement this vec /: Cross[Cross[vec[x_], vec[y_]], Cross[vec[x_], vec[z_]]] := Cross[vec@x, Cross[vec@y, Cross[vec@x, vec@z]]] - Cross[vec@y, Cross[vec@x, Cross[vec@x, vec@z]]] but it gives error "Tag vec in (vec[x_][Cross]vec[y_])[Cross](vec[x_][Cross]vec[z_]) \ is too deep for an assigned rule to be found."
– aly
Jan 30, 2016 at 17:15