Can this formula be minimized in an exact way? $r(x) = \sqrt{x^2 + (Kx + M)^2}$

44 Views Asked by At

I have this formula

$$r(x) = \sqrt{x^2 + (Kx + M)^2}$$

Where $Kx + M$ is the straight line equation. My goal is to use the L2 norm to find the shortest distance beteen origo (0,0) and the straight line, by selecting $x$.

So I want to find the minimum $r$. Can this be done using an algorithm, or can I minimize this equation in an exact way?

2

There are 2 best solutions below

1
On BEST ANSWER

An alternative to the other answer is to use calculus.

Minimizing $r(x)$ is the same as minimizing:

$$R(x)=[r(x)]^2=x^2+(Kx+M)^2$$

The first-order condition is

$$R'(x)=2x+2K(Kx+M)=2(1+K^2)x+2KM=0$$

The solution to the first-order condition is

$$x^*=-\frac{KM}{1+K^2}.$$

We also have for all $x$:

$$R''(x)=2(1+K^2)>0$$

so that $R$ is (strictly) convex. Thus $x^*$ is the unique minimizer of $R$ and hence of $r$.

0
On

$r^2=x^2+(Kx+M)^2= x^2+K^2x^2+2KMx+M^2$

$r^2=x^2(1+K^2)+2KMx+M^2$

$r^2/(1+K^2)=x^2+\frac{2KM}{1+K^2} x+\frac{M^2}{1+K^2}$

$r^2/(1+K^2)=x^2+\frac{2KM}{1+K^2}x+ \frac{K^2M^2}{(1+K^2)^2}+\frac{M^2(1+K^2)-K^2M^2}{(1+K^2)^2}$

$r^2/(1+K^2)=[x+\frac{KM}{1+K^2}]^2+\frac{M^2}{(1+K^2)^2}$