Distance from a vector to a subspace

In summary, there are multiple methods to find the distance from a vector to a subspace given by a system of linear equations. One method involves finding an orthonormal basis for the orthogonal complement of the subspace and projecting the vector onto this basis. Another method involves finding an orthonormal basis for the subspace itself and using this to calculate the distance. It is important to carefully read the question and make sure the correct distance is being calculated.
  • #1
smile1
19
0
Hello everyone

Here is the question

Find the distance from a vector $v=(2,4,0,-1)$ to the subspace $U\subset R^4$ given by the following system of linear equations:
$2x_1+2x_2+x_3+x_4=0$
$2x_1+4x_2+2x_3+4x_4=0$

do I need to find find a point $a$ in the subspace $U$ and write the vector $a-v$ and find the length of it?
 
Physics news on Phys.org
  • #2
smile said:
Hello everyone

Here is the question

Find the distance from a vector $v=(2,4,0,-1)$ to the subspace $U\subset R^4$ given by the following system of linear equations:
$2x_1+2x_2+x_3+x_4=0$
$2x_1+4x_2+2x_3+4x_4=0$

do I need to find find a point $a$ in the subspace $U$ and write the vector $a-v$ and find the length of it?

Hi smile, :)

Let \((X,\,d)\) be a metric space and \(U\subset X\). Distance between a point \(a\in X\) and \(U\) is defined as,

\[d(a,\, U)=\mbox{Inf }\{d(a,\,y):\, y\in U\}\]

In the given problem \(v=(2,4,0,-1)\) and take any vector \(u=(x_1,\,x_2,\,x_3,\,x_4)\in U\). Then,

\[d(v,\,u)=|(x_1,\,x_2,\,x_3,\,x_4)-(2,4,0,-1)|\]

This would give you a quadratic function with four variables. Since \(v\) satisfies the given equations you can reduce that into a quadratic with two variables. Then find the minimum of that quadratic (suggestion: use the second partial derivative test).

Hope this helps. :)
 
  • #3
You could also use the fact that the shortest vector connecting $v$ to $U$ is perpendicular to $U$.

First find a basis in $U$. One way is to subtract the first equation from the second. Then you could pick any $x_3$, $x_4$, and $x_1$, $x_2$ would be uniquely determined. For example, $x_3=2$, $x_4=0$ gives vector $u_1=(0,-1,2,0)$, and $x_3=0$, $x_4=2$ gives $u_2=(2.-3,0,2)$. We have the following data:
\begin{align*}
|u_1|^2&=9\\
|u_2|^2&=17\\
(u_1,u_2)&=3\\
(v,u_1)&=-4\\
(v,u_2)&=-10
\end{align*}
Now state that the connecting vector is perpendicular to $U$:
\begin{align*}
(v-y_1u_1-y_2u_2,u_1)&= (v,u_1)-y_1|u_1|^2-y_2(u_2,u_1)=0\\
(v-y_1u_1-y_2u_2,u_2)&= (v,u_2)-y_1(u_1,u_2)-y_2|u_2|^2=0
\end{align*}
This gives two equations in $y_1$, $y_2$. The final answer is $|v-y_1u_1-y_2u_2|$.

All calculations should be rechecked.
 
  • #4
smile said:
Hello everyone

Here is the question

Find the distance from a vector $v=(2,4,0,-1)$ to the subspace $U\subset R^4$ given by the following system of linear equations:
$2x_1+2x_2+x_3+x_4=0$
$2x_1+4x_2+2x_3+4x_4=0$

do I need to find find a point $a$ in the subspace $U$ and write the vector $a-v$ and find the length of it?
Yet another method is to find an orthonormal basis for the orthogonal complement $U^\perp$ of $U$. The two given equations say that the vectors $(2,2,1,1)$ and $(1,2,1,2)$ are in $U^\perp$. By a happy coincidence, the sum and the difference of those vectors, namely $(3,4,2,3)$ and $(1,0,0,-1)$, are orthogonal to each other. So if we divide them by their lengths, we see that the vectors $e_1 = \frac1{\sqrt{38}}(3,4,2,3)$ and $e_2 = \frac1{\sqrt2}(1,0,0,-1)$ form an orthonormal basis for $U^\perp$. The projection of $v$ onto $U^\perp$ is the vector $\langle v,e_1\rangle e_1 + \langle v,e_2\rangle e_2$, and the length of that vector is the distance from $v$ to $U$. I make it $\sqrt{14}$.
 
  • #5
Sudharaka said:
Hi smile, :)

Let \((X,\,d)\) be a metric space and \(U\subset X\). Distance between a point \(a\in X\) and \(U\) is defined as,

\[d(a,\, U)=\mbox{Inf }\{d(a,\,y):\, y\in U\}\]

In the given problem \(v=(2,4,0,-1)\) and take any vector \(u=(x_1,\,x_2,\,x_3,\,x_4)\in U\). Then,

\[d(v,\,u)=|(x_1,\,x_2,\,x_3,\,x_4)-(2,4,0,-1)|\]

This would give you a quadratic function with four variables. Since \(v\) satisfies the given equations you can reduce that into a quadratic with two variables. Then find the minimum of that quadratic (suggestion: use the second partial derivative test).

Hope this helps. :)

Sorry, I guess my method is incorrect, as I have misread the question and calculated the distance from the point \((2,4,0,-1)\) to the subspace as opposed to the distance from the vector to the subspace. :)
 
  • #6
Opalg said:
Yet another method is to find an orthonormal basis for the orthogonal complement $U^\perp$ of $U$. The two given equations say that the vectors $(2,2,1,1)$ and $(1,2,1,2)$ are in $U^\perp$. By a happy coincidence, the sum and the difference of those vectors, namely $(3,4,2,3)$ and $(1,0,0,-1)$, are orthogonal to each other. So if we divide them by their lengths, we see that the vectors $e_1 = \frac1{\sqrt{38}}(3,4,2,3)$ and $e_2 = \frac1{\sqrt2}(1,0,0,-1)$ form an orthonormal basis for $U^\perp$. The projection of $v$ onto $U^\perp$ is the vector $\langle v,e_1\rangle e_1 + \langle v,e_2\rangle e_2$, and the length of that vector is the distance from $v$ to $U$. I make it $\sqrt{14}$.

I have a little question that perhaps you could clarify. :) How do we know that \(e_1\mbox{ and }e_2\) form a basis for \(U^\perp\)? Don't we have to show that?
 
  • #7
Sudharaka said:
I have a little question that perhaps you could clarify. :) How do we know that \(e_1\mbox{ and }e_2\) form a basis for \(U^\perp\)? Don't we have to show that?

they are obtained by using the Gram-Schmidt orthogonalization, so I think they are basis automatically, if you want to prove that just using the definition of basis.
Hope that helps.
 

FAQ: Distance from a vector to a subspace

What is the definition of "Distance from a vector to a subspace"?

The distance from a vector to a subspace is the shortest distance between the vector and any point in the subspace. It is a measure of how far the vector is from the subspace.

How is the distance from a vector to a subspace calculated?

The distance from a vector to a subspace can be calculated by finding the projection of the vector onto the subspace and then finding the distance between the vector and its projection. This can be done using the formula d = ||v - proj_u(v)||, where v is the vector and u is a basis for the subspace.

Why is the distance from a vector to a subspace important?

The distance from a vector to a subspace is important because it can be used to determine the best approximation of a vector by a subspace. It is also useful in many applications, such as machine learning and data analysis, for measuring the similarity between vectors and determining their relationships.

Can the distance from a vector to a subspace be negative?

No, the distance from a vector to a subspace cannot be negative. Distance is always a positive quantity, and the distance from a vector to a subspace is no exception.

Are there any real-life examples of the concept of "Distance from a vector to a subspace"?

Yes, there are many real-life examples of the distance from a vector to a subspace. One example is in data analysis, where the distance between data points and a subspace can be used to cluster and classify data. Another example is in physics, where the distance between a point and a plane can be calculated using the concept of distance from a vector to a subspace.

Similar threads

Back
Top