# Are two vectors pointing in the same direction regarding a surface?

Given two vectors $a$ and $b$ and a hyper-surface $S$, I would like to know whether the two vectors point in the same direction regarding the surface.

### Example 1

Here they point in different directions:

$$S = x \cdot (0,1) + 0 \\ a = (1,0)\\ b = (-1,0)$$

### Example 2

But here they also point in different directions:

$$S = x \cdot (0,1) + 0 \\ a = (0.1,10)\\ b = (-0.1,10)$$

### Example 3

Here they point in the same direction:

$$S = x \cdot (1,0,0) + y \cdot (0,1,0) + 5\\ a = (1,1,1)\\ b = (-1,-1,1)\\$$

### Example 4

Here they point in different directions:

$$S = x \cdot (1,0,0) + y \cdot (0,1,0) + 5\\ a = (1,1,1)\\ b = (1,1,-1)\\$$

## 1 Answer

You can use determinants for that purpose. If you have an $n$-dimensional space, then you have $n-1$ vectors defining $S$. Create an $n\times n$-matrix which has those vectors as the first $n-1$ rows, and the last row is $a$ or $b$ resp. If the determinants of the resulting matrices differ in sign, then $a$ and $b$ point in different directions; if they have the same sign, they point in the same direction (regarding the plane or line $S$).

If you know the Hesse normal form of the plane or line, it is even easier. Then you simply compare the signs of the dot products $n_0\cdot a$ and $n_0\cdot b$, where $n_0$ is the normal vector in the Hesse normal form.