Is there a way specify the variables for Solve so that it can be used to solve for vector-valued variables?

For example I'd like to solve

$$(1,i)+v = 0$$

which it seems I can only do by solving for each of he components of $v$ explicitly with


since none of the likely alternative approaches work:


all fail to produce any solutions (and produce various errors).

Is there a way to solve directly for v without specifying components?

  • $\begingroup$ @swish: Yes, thats what I'm asking: is there a way to solve for the vector, not it's components? So the answer is 'no'? $\endgroup$
    – orome
    Commented Sep 20, 2017 at 13:38
  • 2
    $\begingroup$ Note that {1, I} + v evaluates to {1+v, I+v}. Basically, you shouldn't mix symbolic and explicit arrays/tensors. $\endgroup$
    – Carl Woll
    Commented Sep 20, 2017 at 14:44
  • $\begingroup$ @CarlWoll: Good point. I've run into that before and it makes a mess of things. $\endgroup$
    – orome
    Commented Sep 20, 2017 at 14:48

1 Answer 1


Perhaps not entirely satisfactory, but this

With[{v=Array[_,2]}, v/.First@Solve[{1,I}+v=={0,0},v]]



In effect v=Array[_,2] serves to specify the domain of the solution as being vectors of length 2.

Even without the clever substitution, the result is meaningful:




which is fairly easily understood, since once a solution, sol, is picked substitition works as expected:

Array[_,2] /. sol

Things git a bit more awkward though (and not all that different from specifying operate variables for each element) when more than one such vector is involved. In that case it is necessary to distinguish the elements:

With[{v=Array[v,2],w=Array[w,2]}, Solve[{1,I}+v=={0,0} && v+w=={0,0}, Flatten@{v,w}]]

and once a solution is picked the vectors no need to be distinguished by name, of course:

v = Array[v,2]/.sol
w = Array[w,2]/.sol

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.