# Is it possible to solve vector equations?

For example if we define parametric line segment

curve1[t_, p1_, p2_] := t*p2 + (1 - t)*p1;


where p1 and p2 are 2D vectors, we can draw it easily

p1 = {0, 0}; p2 = {1, 2}; ParametricPlot[curve1[t, p1, p2], {t, 0, 1}]


But can't solve in general form

Clear[p1, p2]
Solve[curve1[t, p1, p2] == curve1[u, q1, q2], {t, u}]


because Mathematica treats p1, p2, q1 and q2 as scalars, and gives

$$\left\{\left\{u\to -\frac{t (\text{p2}-\text{p1})}{\text{q1}-\text{q2}}-\frac{\text{p1}-\text{q1}}{\text{q1}-\text{q2}}\right\}\right\}$$

Can I treat them as vectors and solve analytically?

• @DanielHuber of course not, if p1, p2, q1 and q2 are all different, it doesn't true.
– Dims
Commented Jan 13, 2022 at 10:38
• Sorry I read it too fast. Commented Jan 13, 2022 at 10:51
• This may be a starting point: Reduce[curve1[t, p1, p2] == curve1[u, q1, q2] && (p1 | p2 | q1 | q2) ∈ Vectors[2, Reals], {t, u}] Commented Jan 13, 2022 at 10:54

You can use Vectors.

Solve[curve1[t, p1, p2] == curve1[u, q1, q2] && (p1 | p2 | q1 | q2) ∈ Vectors[2, Reals] && (t|u) ∈ Reals, {t, u}] //FullSimplify


Clear[p1, p2]
curve1[t_, p1_, p2_] := t*p2 + (1 - t)*p1;
{p1, p2, q1, q2} = {{p1x, p1y}, {p2x, p2y}, {q1x, q1y}, {q2x, q2y}};
Solve[curve1[t, p1, p2] == curve1[u, q1, q2], {t, u}]


• It's cheating :) Can I just tell solver, that some variables are vectors?
– Dims
Commented Jan 13, 2022 at 10:56
• How do you know that it can be written without respect to the vector components? Commented Jan 13, 2022 at 10:58