Check if nD point lies within nD Hypersphere defined by n+1 points I am writing some code where I need to be able to determine if a specific n-D point lies within a n-D hypersphere defined by n+1 points. The 2D version of this is clear to me; to check if a point, p,  lies within a circle defined by a triangle abc, one can just compute the determinate of the following matrix:
[a_x, a_y, |a|, 1]
[b_x, b_y, |b|, 1]
[c_x, c_y, |c|, 1]
[p_x, p_y, |p|, 1]
(|n|= n_x^2+n_y^2)
if the determinate is greater than zero then the point lies outside of the circle, if its zero, its on the circle, else it is within the circle.
I am hoping that this can scale up to how ever many dimensions I need, but I am unsure if it will as I do not know what would go in the additional column would be, obviously the new row would represent the new point.
Any help or suggestion would be greatly appreciated! thanks!
 A: Your simple formulation has a flaw -- if I change points $A,B$ around, the determinant get multiplied by $-1$ so inside turned into outside.  It is either a feature or a bug, I don't know your intention.
To get the usual formulation,
$$
\det
\begin{pmatrix}
a_x^2+a_y^2 & a_x & a_y & 1\\
b_x^2+b_y^2 & b_x & b_y & 1\\
c_x^2+c_y^2 & c_x & c_y & 1\\
x^2+y^2 & x & y & 1
\end{pmatrix}=0
$$
is the Cartesian formula for the circle through $A,B,C$ (assuming the points are not collinear, i.e. the coefficient of $x^2+y^2$ is nonzero).  So a point is strictly outside (resp inside) the circle iff
$$
\det
\begin{pmatrix}
a_x^2+a_y^2 & a_x & a_y & 1\\
b_x^2+b_y^2 & b_x & b_y & 1\\
c_x^2+c_y^2 & c_x & c_y & 1\\
p_x^2+p_y^2 & p_x & p_y & 1
\end{pmatrix},
\det
\begin{pmatrix}
a_x & a_y & 1\\
b_x & b_y & 1\\
c_x & c_y & 1
\end{pmatrix}
$$
have the same (resp. opposite) sign.  (Remember we want the coefficient of $x^2+y^2$ to be 1 in the usual Cartesian equation of circle $\Gamma\colon C=0$ before saying $C<0$ is the inside and $C>0$ is the outside.)
This is the formulation that generalises: if the $n+1$ points $P^{(1)},\dots,P^{(n+1)}$ does not lie on a hyperplane, then point $P$ is inside/on/outside the hypersphere defined by $P^{(i)}$ if
$$
\det
\begin{pmatrix}
\lvert P^{(1)}\rvert^2 & p^{(1)}_1 & \dots & p^{(1)}_{n+1} & 1\\
\lvert P^{(2)}\rvert^2 & p^{(2)}_1 & \dots & p^{(2)}_{n+1} & 1\\
\vdots & \vdots & \ddots & \vdots & \vdots\\
\lvert P^{(n+1)}\rvert^2 & p^{(n+1)}_1 & \dots & p^{(n+1)}_{n+1} & 1\\
\lvert P\rvert^2 & p_1 & \dots & p_{n+1} & 1
\end{pmatrix}
$$
has the opposite/zero/same sign as
$$
\det
\begin{pmatrix}
p^{(1)}_1 & \dots & p^{(1)}_{n+1} & 1\\
p^{(2)}_1 & \dots & p^{(2)}_{n+1} & 1\\
\vdots & \ddots & \vdots & \vdots\\
p^{(n+1)}_1 & \dots & p^{(n+1)}_{n+1} & 1
\end{pmatrix}.
$$
A: You can solve for the center of the circumsphere of the simplex defined by the $n+1$ points, as follows:
Suppose your circumcenter is $c.$ Then
$$\|c - v_i\| = R^2,$$ for all $i.$ You don't know $R^2,$ but it does follow that
$$\|c-v_i\| = \|c-v_j\|,$$ for all $i, j.$ Expanding the square of the norm as inner product, you see that:
$$\|v_i\|^2 - \|v_j\|^2 = 2 \langle c, v_i - v_j\rangle,$$ for every $i, j.$ Now, by a translation, put $v_0$ at the origin, so you have
$$\|v_i\|^2 = 2 \langle c, v_i\rangle$$ for every $i=1, \dotsc, n.$
You can solve this system of linear equations for $c$ and then compute $R$ from the very very first equation above. Now, for your new point, just check that the distance to $c$ is less than $R.$
