2

Context: This question is somewhat identical to this on MathOverflow, it’s different in that it only focuses on the formula of the solution to the underlying problem.


Suppose I have a convex hull $H$ from the $\mathbb{R}^n$ vertices of a polytope. What is the formula to determine whether a point $p$ is contained within the polytope (convex hull $H$)?

linker
  • 297
  • 1
    Your question amounts to find a description of your polytope under the form $AX \le B$ with the test $Ap \stackrel{\large{<}}{\ge} B$. – Jean Marie May 03 '22 at 08:03
  • Hi @JeanMarie, Your comment wasn’t in english :) and its definitely beyond me at this current point in time. The polytope being in the question is just for context sake, I am only interested in a general formula for finding out if a point $p$ exists within some convex hull $H$ – linker May 03 '22 at 09:50
  • Please correct my sentence. I will be happy to improve my english. Besides, description of a polytope by a matrix-vector inequality (gathering a set of linear inequalities) $AX \le B$ is completely standard : sooner or later, you will need it in this kind of issues. – Jean Marie May 03 '22 at 09:53
  • 1
    @JeanMarie was just pulling your legs in the sense that the comment was beyond my understanding :)… nothing obviously wrong with the english – linker May 03 '22 at 09:57
  • You may want to take a look at chapter 5 of Kroening & Strichman. – Rodrigo de Azevedo May 06 '22 at 15:16

1 Answers1

3

Assume the vertices that span the convex hull are $v_1,v_2,\dots,v_k\in\mathbb{R}^n$ with coordinates $$ v_i = (v_{i1},v_{i2},\dots,v_{in}). $$

A point $p\in\mathbb{R}^n$ lies in the convex hull if and only if there exists $\lambda_1,\dots,\lambda_k\geq 0$ with $\sum \lambda_j = 1$ satisfying $$ \sum_{j=1}^k \lambda_j v_j = p. $$

Let $V$ be the $n\times k$ matrix with columns $v_1,v_2,\dots,v_k$, so the above equation can be written as $$ V\lambda = p $$ where $\lambda$ denotes the (column) vector $(\lambda_1,\dots,\lambda_k)$. Add the row $(1,1,\dots,1)$ to $V$ to get the matrix $V'$, so $V'$ has the form $$ V' = \begin{bmatrix} v_{11} & v_{21} & \dots & v_{k1}\\ v_{12} &\ddots & &\vdots \\ \vdots & &\ddots &\vdots \\ v_{1n} & & & v_{kn}\\ 1 & 1 & \dots & 1 \end{bmatrix}. $$

Then, $p$ is in the convex hull if and only if there exists a $\lambda\in\mathbb{R}^k$ satisfying $$ V'\lambda=\begin{bmatrix} p\\ 1 \end{bmatrix},\qquad\text{and}\qquad \lambda\geq 0. $$ This is a linear program and you can check if it is feasible using linear programming algorithms.

Levent
  • 5,300
  • Hi @Levent, from this $ \sum_{j=1}^k \lambda_j v_j = p. $ what’s $\lambda_j$ equal to exactly, I mean how does one come about the values of $\lambda_1,\dots,\lambda_k$? – linker May 04 '22 at 20:12
  • @LiNKeR - for underdetermined problem please see: https://math.stackexchange.com/questions/715807/finding-nonnegative-solutions-to-an-underdetermined-linear-system – HEKTO May 08 '22 at 03:37
  • @LiNKeR - for overdetermined problem - another way: https://en.wikipedia.org/wiki/Non-negative_least_squares – HEKTO May 08 '22 at 03:41
  • @HEKTO thanks, though I still could not find a way to express $\lambda$ explicitly after going through everything (I am no mathematician). I plan on implementing this answer programmatically by considering that a point $p\in\mathbb{R}^n$ existing within a convex hull $H$, according to this always meets the following conditions: – linker May 10 '22 at 13:10
  • (a) each $\lambda$ would be $\geq0$ i.e. $(\lambda_1,\dots,\lambda_k)\geq 0$ (b) all $\lambda$s would sum up to be equal to one i.e. $\sum \lambda_j = 1$ (c) and then the sum of the product of vertices and lambda from the convex hull $H$ would equal the point $p$ i.e. $$ \sum_{j=1}^k \lambda_j v_j = p. $$ – linker May 10 '22 at 13:10
  • You basically need to run an algorithm for linear programming feasibility for the linear program I described. As far as I know, there is no simple formula to see if $p$ is in the convex hull other than this method. There are many libraries in many programming languages for linear programming. – Levent May 10 '22 at 20:16