Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an old exam question I need help with before my upcoming exam:

Let $u = (x_1, y_1)$ and $v = (x_2,y_2)$.

Define an inner product in $\mathbb{R}^2$, $\langle u, v\rangle =2x_1x_2+x_1y_2+x_2y_1+3y_1y_2$.

Now I want to find the distance between the line $x+y=1$ and $(0,0)$

My attempt: Let $u=(x,y)$ be the vector we're looking for, $\langle u, u\rangle =2x^2+2xy+3y^2$, call this $B$, so the norm is $\frac{1}{\sqrt{B}}$.

I think there should be a way to do this by diagonalizing the matrix $A$, which is the matrix for our polynomial. So we get $A=T^{-1}DT$, then make a variable-substitution $(u,v)=(x,y)T$ to eliminate the $2xy$-term in our polynomial, then use $x+y=1$ to solve for the smallest value. Is this correct?

Is there any shorter solution I can do? Like using $x+y=1$ directly on $2x^2+2xy+3y^2$?

Bare with my english, but plz let me know where my mathematical notation is wrong!


share|cite|improve this question
In future, you can use Latex commands (in between dollar signs) to make the mathematics look nicer. You can check the edit I just made to see some examples. – Michael Albanese Jan 6 '13 at 5:20
Thank you Michael, I will do that! – HansDeKling Jan 6 '13 at 5:23
That is not an inner product. Is the term $x_1y_1$ correct? – WimC Jan 6 '13 at 7:50
Oh no, you are right. I mistyped it :( Ill edit...Thx! – HansDeKling Jan 6 '13 at 7:55
up vote 1 down vote accepted

The shortest distance between a fixed point $a$ off a line and a variable point $b$ on a line occurs when $b - a$ is perpendicular to the line. In this case the line $x+y=1$ can be expressed with the inner product as $$\ell = \{ (x, y) \mid x+y = 1\} = \{ u \mid \langle u, (2, 1) \rangle = 5 \}.$$ In this last form it is clear that $(2,1)$ is perpendicular to $\ell$. The point closest to $(0,0)$ is therefore the intersection of $\ell$ with the line through $(0,0)$ and $(2,1)$. Then use the inner product again to find the distance between that point and $(0,0)$.

share|cite|improve this answer
Thx! I realize now that this wasn't the type of exercise I wanted to ask about. Although, Ive learned sth new! Satisfied. – HansDeKling Jan 6 '13 at 10:27

I am not sure what you mean by the matrix of a polynomial, so I'm afraid I can't answer the question directly.

A way that makes use of the linear algebra you know is to choose some vector on the line, which will have the form $\mathbf{x}=\begin{bmatrix} x \\ 1-x \end{bmatrix}$. If a vector points along the shortest distance from a point to a line, it will necessarily be orthogonal to the line.

We know that the line has its "slope" vector to be $\mathbf{m}=\begin{bmatrix} 1 \\ -1 \end{bmatrix}$. Therefore, when we set the inner product $\langle\mathbf{x},\mathbf{m}\rangle=0$, we get \begin{align} 2x-x(1-x)+(1-x)-3 &= 0 \\ x^2+2x-2x+1-3 &=0 \\ x^2 &= 2 \\ x &= \pm \sqrt2 \end{align}

Thus, the desired vector is $\begin{bmatrix} \sqrt2 \\ 1-\sqrt2 \end{bmatrix}$, and so the distance is the square root of the inner product with itself: \begin{align} \langle\mathbf{x},\mathbf{x}\rangle &= 2(\sqrt2)^2+2\sqrt2(1-\sqrt2)+3(1-\sqrt2)^2 \\ & = 4 + 2\sqrt2 - 4 + 3(3-2\sqrt2) \\ & = 9 - 4\sqrt2, \end{align}

which is $\sqrt{9-4\sqrt2} = 2\sqrt2 -1$.

share|cite|improve this answer
Thx Eric, I didnt think about the fact that $\mathbf{x}=\begin{bmatrix} x \\ 1-x \end{bmatrix}$. This was a much neater way to do it. – HansDeKling Jan 6 '13 at 6:00
What I meant by the matrix of the polynomial was, $(x,y)\begin{bmatrix} 2,1 \\ 1,3 \end{bmatrix}(x,y)^t$. Perhaps I cant say that this is a matrix of a polynomial? – HansDeKling Jan 6 '13 at 6:04
I've never seen the concept used that way before, but I also haven't studied a lot of linear algebra :) – Eric Stucky Jan 6 '13 at 6:23
Aha ok, I had no idea. Never seen a forum in this format before. I appreciate your answer, but Ill wait and see then. The thing is, I believe that some of the questions of this type on my exam will be in such a form that I cant use your solution, so I need some more answers :) Thx again for replying, and telling me about the system of this site. – HansDeKling Jan 6 '13 at 7:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.