# Solving vector equations with dot products

I'm working on a triangle-triangle intersection algorithm using this article ("The Line Intersection of Two Planes" part). The problem is that I don't know how to solve vector equations with dot products.

N1 . (X - Q1) = 0
N2 . (X - Q'1) = 0
X[2] = 0


I have vectors N1, N2, Q1, Q'1 and the value of X[2] wich is 0. How can i find the value of X[0] and X[1]?

-
Do you know how to solve systems of linear equations? – joriki Jan 14 '13 at 22:53
The usual discrete inner product is $A\cdot B$ = $\sum a_i b_i$, you can substitute to get scalar equations... – yoki Jan 14 '13 at 22:59
This is a problem well-suited to projective geometry. Is that an approach you'd consider instead? The solutions to such problems in projective space are known (you would not have to solve a system of equations, merely evaluate the answer). – Muphrid Jan 14 '13 at 23:41

Suppose that $N1=[N_{11},N_{12},N_{13}]$ and $N2=[N_{21},N_{22},N_{23}]$, as well as similar representations for $Q1$ and $Q'1$. The equations can then be written in the form: \begin{align} N_{11}(x_0-Q_{11})+N_{12}(x_1-Q_{12})+N_{13}(x_2-Q_{13})&=0\\ N_{21}(x_0-Q'_{11})+N_{22}(x_1-Q'_{12})+N_{23}(x_2-Q'_{13})&=0\\ x_2&=0 \end{align} Now, using the third equation $x_2=0$ and substituting this into the first two equations, upon expanding the brackets produces: \begin{align} N_{11}x_0+N_{12}x_1&=N_{11}Q_{11}+N_{12}Q_{12}+N_{13}Q_{13}\\ N_{21}x_0+N_{22}x_1&=N_{21}Q'_{11}+N_{22}Q'_{12}+N_{23}Q'_{13}\\ \end{align} This is a system of linear equations, which can be solved by any of the methods described here. Using any of these techniques, you obtain the solution for this linear system as \begin{align} x_0&={N_{22}\left(N_{11}Q_{11}+N_{12}Q_{12}+N_{13}Q_{13}\right)-N_{12}\left(N_{21}Q'_{11}+N_{22}Q'_{12}+N_{23}Q'_{13}\right) \over N_{11}N_{22}-N_{12}N_{21}},\\ x_1&={N_{11}\left(N_{21}Q'_{11}+N_{22}Q'_{12}+N_{23}Q'_{13}\right)-N_{21}\left(N_{11}Q_{11}+N_{12}Q_{12}+N_{13}Q_{13}\right) \over N_{11}N_{22}-N_{12}N_{21}}. \end{align}