Sign up ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I have to find the best fitting square using the total least squares method. First we we had to find the best fitting rectangle using the following equations:

  • s1: $c1+ax+by=0$, $a^2 +b^2 =1$
  • s2: $c2−bx+ay=0$,
  • s3: $c3+ax+by=0$,
  • s4: $c4−bx+ay=0$,

So, s1 corresponds to side 1 with x,y being the measurements for that side (so a couple of points through which a line must be found).

Using the least squares method we have to solve: (not enough reputation)

I succeeded in finding the rectangle, but we also had to find the best fitting square. We were given that the distance between two parallel lines

  • A: $c1+ax+by=0$, $a^2+b^2=1$
  • B: $c2+ax+by=0$

is |c1-c2|. So naturally the equations have to be modified to reflect that $|c1-c3|=|c2-c4|$.

I think I have almost tried everything, I just can't find a right solution. (I tried letting c2 = c1+d and c4 = c3 +- d; I tried c1 = c2 + c3 - c4)

share|cite|improve this question

Your Answer


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

Browse other questions tagged or ask your own question.