Intereting Posts

Mathematical background for TQFT
Maximum principle – bounds on solution to heat equation with complicated b.c.'s
General misconception about $\sqrt x$
Show that $E(X)=\int_{0}^{\infty}P(X\ge x)\,dx$ for non-negative random variable $X$
Show that for any $f\in L^1$ and $g \in L^p(\mathbb R)$, $\lVert f ∗ g\rVert_p \leqslant \lVert f\rVert_1\lVert g\rVert_p$.
The value of $\int^{\pi/2}_0 \frac{\log(1+x\sin^2\theta)}{\sin^2\theta}d\theta$
Greatest common divisor is the smallest positive number that can be written as $sa+tb$
Probability for the length of the longest run in $n$ Bernoulli trials
Let p be a prime. Consider the equation $\frac1x+\frac1y=\frac1p$. What are the solutions?
Gradients of marginal likelihood of Gaussian Process with squared exponential covariance, for learning hyper-parameters
Fourier operator $\mathcal{F}:L^p(\mathbb{T})\rightarrow \ell^{p'}(\mathbb Z)$ ($1< p < 2$, $\frac{1}{p}+\frac{1}{p'}=1$) is not onto
Value of: $ \frac {1} {\sqrt {4} + \sqrt {5}} + \frac {1} {\sqrt {5} + \sqrt {6}} + … + \frac {1} {\sqrt {80} + \sqrt {81}}$
Why differential Galois theory is not widely used?
Local and global logarithms
Solve $\sin(z) = z$ in complex numbers

I am trying to find a method with a low computational cost to compute the distance of a point $P$ and a space $S$ that is defined by the origin $O$ and $m$ vectors $v_1, v_2, …, v_m$ in an $n$-dimensional space ($m<n$). The vectors are not restricted by any means other than that they are not 0. Furthermore, I would like to identify the point in $S$ that is closest to $P$.

This calculation is part of a ‘fitting function’ for a machine learning problem and thus has to be executed rather often and should be fast. The input to the function is as defined above, $P$ and $v_1, v_2, …, v_m$. This is just for context and I am happy for a mathematical solution and can of course do the implementation myself.

Thanks in advance and please let me know if I need to specify anything in more detail.

- How to prove the optimal Towers of Hanoi strategy?
- Why is convexity more important than quasi-convexity in optimization?
- What is the algorithm hiding beneath the complexity in this paper?
- Matrix Chain Multiplication?
- How to prove that this function is primitive recursive?
- Are sets and symbols the building blocks of mathematics?

- Proof Strategy for a Dynamical System of Points on the Plane
- Basic Geometric intuition, context is undergraduate mathematics
- First-order formula in first-order language, another open language where equivalence true on the naturals?
- construct circle tangent to two given circles and a straight line
- Transforming from one spherical coordinate system to another
- Does the ternary dot product have any geometric significance?
- Angular alignment of points on two concentric circles
- Calculating circle radius from two points on circumference (for game movement)
- Finding a curve that intersects any line on the plane
- Consider a right angled $\triangle PQR$ right angled at $P$ i.e ($\angle QPR=90°$) with side $PR=4$ and area$=6$.

I think the most efficient way is to compute projection $\mathrm{Pr}_L(p)$ of vector $p$ on linear subspace $L$ spanned by vectors $v_1,\ldots,v_m$ and the find length of the vector $p-\mathrm{Pr}_L(p)$. Using modified Gramm-Schmidt orthogonalization process you can find orthogonal basis of $L$, call it $\{e_1,\ldots,e_m\}$ and then compute

$$

\mathrm{Pr}_L(p)=\sum\limits_{i=1}^m \langle p,e_i\rangle e_i

$$

The desired distance is

$$

d(p,L)=\left\Vert p-\sum\limits_{i=1}^m \langle p,e_i\rangle e_i\right\Vert

$$

There is an elegant but useless for your purposes formula of the distance $d(p,L)$ from point $p\in\mathbb{R}^n$ to linear subspace $L$ spanned by vectors $v_1,\ldots, v_m$. It can be found by the formula

$$

d^2(p,L)=\frac{G(v_1,\ldots,v_m,p)}{G(v_1,\ldots,v_m)}\tag{1}

$$

where

$$

G(v_1,\ldots,v_k)=\det

\begin{Vmatrix}

\langle v_1,v_1 \rangle & \ldots & \langle v_1,v_k \rangle\\

\ldots & \ldots & \ldots\\

\langle v_k,v_1 \rangle & \ldots & \langle v_k,v_k \rangle

\end{Vmatrix}

$$

is a Gram determinant.

I’ll assume that you’re talking about Euclidean distance and that everything that’s given is given in terms of Cartesian coordinates in the $n$-dimensional space.

Let $A$ be the matrix whose columns are your vectors $V_i$, and let $b$ be the vector of coordinates of $p$. Then you’re looking for a vector $x$ of $m$ coefficients such that $\|Ax-b\|\to\min$.

There are various methods for finding this $x$: you can

- solve the normal equations;
- perform a QR decomposition of A, either using Gram-Schmidt or Householder reflections;
- use the Moore–Penrose pseudoinverse, determined by singular value decomposition.

Which of these is best may depend on your requirements for speed and accuracy. If your vectors may be linearly dependent or nearly so, I believe the last option is the most numerically stable, whereas otherwise solving the normal equations should be good enough and probably quickest. How best to proceed may also depend on whether $A$ and $b$ are different in each application, or whether you need to find $x$ for many $b$ with the same $A$.

- Suspension of a product – tricky homotopy equivalence
- Measure zero of the graph of a continuous function
- How does Lambert's W behave near ∞?
- Calculating $\int_0^\infty \frac{\sin(x)}{x} \frac{\sin(x / 3)}{x / 3} \frac{\sin(x / 5)}{x / 5} \cdots \frac{\sin(x / 15)}{x / 15} \ dx$
- Find $\Big\{ (a,b)\ \Big|\ \big|a\big|+\big|b\big|\ge 2/\sqrt{3}\ \text{ and }\forall x \in\mathbb{R}\ \big|a\sin x + b\sin 2x\big|\le 1\Big\}$
- Expanding a potential function via the generating function for Legendre polynomials
- Beautiful Mathematical Images
- If D is an Integral Domain and has finite characteristic p, prove p is prime.
- Solve a matrix equation
- Solutions to exp(x) + x = 2
- Questions on Kolmogorov Zero-One Law Proof in Williams
- What does limit notation with an underline or an overline mean?
- Flip a coin until a head comes up. Why is “infinitely many tails” an event we need to consider?
- Finding a choice function without the choice axiom
- Functional Analysis: The rank of an operator detemines if it's a compact operator.