Check if a point can be written as a linear combination with coefficients $\in[0,1]$

606 Views Asked by At

Given a finite number of points $x_1,x_2,x_3,...,x_n$ in the real 2D vector space, a linear combination of these points is a point of the form $\alpha_1x_1+\alpha_2x_2+...+\alpha_nx_n$.

Suppose a set of points $x_1,x_2,x_3,...,x_n$ and a point $x$ are given. What is a method to check whether $x$ can be written as a linear combination (with coefficients $\in[0,1]$) of all the points from the given set?

1

There are 1 best solutions below

0
On BEST ANSWER

The codomain of the linear combination is the convex hull of the points that are obtained by saturating the alphas. There are $2^n$ of them. (You can visualize this shape as a projection of an hyper-parallelipiped from $n$D space to 2D.)

$x$ can be reached when it is inside that hull, which is a convex polygon of $2n$ vertices.

In the figure, $n=4$.

enter image description here


You can check if a point is inside a convex polygon of $n$ sides in $O(\log n)$ operations, seeing it as two monotone chains.

You can build the hull of the $n$ projected vectors incrementally, by adding the new point to every vertex of the current hull, unless the sum falls inside the hull. This should be doable in $O(n\log n)$ operations.