This is a problem I created to myself but now I can't solve it. Hope you can help me to solve or give some insights.
Fix two vectors $z,w \in \mathbb{R}^n$ and consider the Euclidian inner product. I want to find another vector $x \in \mathbb{R}^n$ such that $x \neq 0$, $x_1w_1 + \dots + x_nw_n$ is as close to zero as possible and $x$ is as close to $z$ as possible. The condition $x_1w_1 + \dots + x_nw_n \approx 0$ ir more relevant, if we have to choose.
My first idea was start finding a vector $x_0$ such that $x_0$ is orthogonal to $w$ and then consider the orthogonal projection of $z$ over $x_0$. This projection is the vector $$x = \frac{\langle z,x_0 \rangle}{\|x_0\|^2} x_0.$$
This is indeed the vector in the form $\lambda x_0$ closest to $z$. Furthermore, we have that $x_1w_1 + \dots + x_nw_n = \langle x, w \rangle = \langle \lambda x_0,z \rangle = \lambda \langle x_0, w \rangle = 0$.
The problem with this approach is that the distance between $x$ and $z$ is not small in general. I'm willing to relax the condition $x_1w_1 + \dots + x_nw_n = 0$ to $x_1w_1 + \dots + x_nw_n \approx 0$, but I just don't know a method to obtain the desired result.