I am working on a hobby web application for a tabletop sci-fi RPG. The tl;dr is the app will provide a lightweight simulation so that the players can focus on the fun and not the math.
One of the simulations uses a quadratic equation where the coefficients are vectors. If I learned to solve such an equation in university linear algebra I have long since forgotten, and I cannot find a resource online.
The equation is the form $At^2 + Bt + C = 0$, where $A, B,$ and $C$ are $3 \times 1$ vectors. I know how to solve a quadratic equation with scalar coefficients. But how do we solve for t when the coefficients are vectors? The standard form would seem to be:
$$ t = \frac{ -B \pm \sqrt{ B^2 - 4AC }}{2A} $$
Would the multiplications be cross products? Would the result of the expression be a vector? I am expecting a scalar result (or two). Is this even the correct approaching to find the solution?
I read through the answers listed below. But the questions (and answers) are about $N \times N$ or $N \times M$ matrices. One answer even says, "solve for $\lambda_1$ and $\lambda_2$ at any desired coordinate" as the answer, with no further details. But that is the part I don't know how to do.
- Quadratic equation with matricial coefficients
- How to solve an equation with vectors
- Solving quadratic vector equation
ADDITIONS
To clarify, The vectors $A, B,$ and $C$ represent coordinates in three-dimensional space and $t$ is time.
It has been suggested in the comments that the solution is to solve the problem with three separate equations: solve one equation, then check if one of the solutions satisfies the other two equations. But this raises a question. Consider the case where $A = \begin{bmatrix} 3 & 0 & 0 \end{bmatrix}$, $B = \begin{bmatrix} 5 & 0 & 0 \end{bmatrix}$, and $C = \begin{bmatrix} 2 & 0 & 0 \end{bmatrix}$. In this case, there is no solution, not even an imaginary one, for two of the equations. Yet there does exist a t that satisfies the equation $At^2+Bt+C=\begin{bmatrix} 0 & 0 & 0 \end{bmatrix}$. So the suggested approach does not appear not to work. What am I missing?
When $P$ is a vector with only nonzero components and $t$ is a real number, the equation $P t^2 + Q t + R=0$ is equivalent to $$t^2 + \left( P^{-1} Q \right) t + \left( P^{-1} R \right) = 0$$
where $P^{-1}$ is defined by $P^{-1} P = 1$. In particular, if $P$ has 3 components, then $P^{-1} = \frac{1}{3}\begin{bmatrix} 1/P_x & 1/P_y & 1/P_z \end{bmatrix}$. This allows you to solve the vector-coefficient quadratic using the familiar formula with substitutions $A=1$, $B=P^{-1}Q$, and $C=P^{-1}R$.
If any of the components of $P$ are zero, you may still find a solution by removing the problematic components from $P$, $Q$, and $R$ and solving those components individually. When the $i$th component of $P$ is $0$ and the corresponding component of $Q$ is nonzero, there is a solution $t_i$ of $Q_it_i+R_i=0$. No solution exists when $P_i=0$, $Q_i=0$, and $R_i \neq 0$.
Overall, a solution exists when all the $t_i$'s are equal -- that is, when for all $i$ such that $P_i=0$, $Q_i\neq0$ and $t_i=t$ where $t$ is the solution of the nonzero-component part.