Projecting a point onto a hypercube

438 Views Asked by At

Let's consider a point $x \in \mathbb{R}^n$ and a hypercube $H_n = \{y \in \mathbb{R}^n: a_i \le y_i \le b_i \}$, where $a_i < b_i, i = 1, 2, \ldots, n$ are fixed, real numbers.

I would like to find a way to project $x$ on $H_n$. How can it be done and why that way is correct? How can I check whether a projection truly is a projection?

By projection I mean "to the nearest point".

1

There are 1 best solutions below

0
On

You can define the point $y$ inside the hypercube that is closest to a given point $x$ like this:

$y_i=\begin{cases}x_i<a_i:&a_i\\a_i≤x_i≤b_i:&x_i\\x_i>b_i:&b_i\end{cases}$

  • If $x_i$ is less than $a_i$, the "projected point" should be on the surface of the hypercube with the smallest coordinate ($a_i$);
  • If $x_i$ is between $a_i$ and $b_i$ that coordinate should go unchanged: it's already within the parameters for that coordinate;
  • If $x_i$ is more than $b_i$, the "projected point" should be on the surface of the hypercube with the greatest coordinate ($b_i$).