maths,

  • {jcomments off}
  • Find the least distance of the line  
    \[ax+by=c\]
      from the point  
    \[(x_0,y_0)\]

    Rearrange the line as  
    \[y=- \frac{a}{b}x+ \frac{c}{b}\]
    .
    The gradient of this line is  
    \[- \frac{a}{b}\]
    .
    The gradient of the perpendicular line is  
    \[\frac{b}{a}\]
    .
    The perpendicular line passes through the point  
    \[(x_0,y_0)\]
    .
    \[y_0=\frac{b}{a}x_0+c \rightarrow c=y_0- \frac{b}{a}x_0\]

    The equation of the perpendicular line is  
    \[y=\frac{b}{a}x+y_0- \frac{b}{a}x_0\]
      Now find the point of intersection of these two lines by solving the simultaneous equations  
    \[ax+by=c, \; y=\frac{b}{a}x+y_0- \frac{b}{a}x_0\]
    , equivalent to
    \[ax+by=c\]
      (1)
    \[bx-ay=bx_0-ay_0\]
      (2)
    Add  
    \[a\]
      times (1) to  
    \[b\]
      times (2) to give
    \[a^2x+b^2x=ac-aby_0-a^2x_0 \rightarrow x= \frac{ac-aby_0-a^2x_0}{a^2+b^2}\]
    .
    Subtract  
    \[a\]
      times (2) from  
    \[b\]
      times (1) to give
    \[a^2y+b^2y= bc-abx_0+a^2y_0 \rightarrow y= \frac{bc-abx_0+a^2y_0}{a^2+b^2}\]
    .
    The distance  
    \[d\]
      is then the distance between the points  
    \[(0,0)\]
      and  
    \[(\frac{ac-aby_0-a^2x}{a^2+b^2}, \frac{bc-abx_0+a^2y_0}{a^2+b^2})\]

    \[\begin{equation} \begin{aligned} d &=\sqrt{(\frac{ac-aby_0+b^2x_0}{a^2+b^2}-x_0)^2+(\frac{bc-abx_0+a^2y_0}{a^2+b^2}-y_0)^2} \\ &=\sqrt{(\frac{ac-aby_0-a^2x_0}{a^2+b^2})^2+(\frac{bc-abx_0-b^2y_0}{a^2+b^2})^2} \\ &= \sqrt{\frac{(a^2+b^2)(c-by_0-ax_0)^2}{a^2+b^2)^2}} \\ &= \frac{c-ax_0-by_0}{\sqrt{a^2+b^2}}\end{aligned} \end{equation}\]
  • If  
    \[gcd(a,n)=1\]
      then  
    \[a^{\phi (n)} \equiv 1 \; (mod \; n)\]
      where  
    \[\phi (n)\]
      is the number of integers between 1 and  
    \[n\]
      relatively prime to  
    \[n\]
    .
    Using this fact we can solve the congruence  
    \[ax \equiv b \; (mod \; n)\]
    .
    \[a^{\phi (n) -1}ax =a^{\phi (n)}x \equiv 1 x= a^{\phi (n) -1}b \; (mod \; n)\]
    .
    For example, the linear congruence  
    \[5x \equiv 11 \; (mod \; 12)\]
      has solution  
    \[x \equiv 5^{\phi (12)-1} \times 11 \equiv 5^{3} \times 11 \; (mod \; 12) \equiv 5 \times 11 \; (mod \; 12) \equiv 7 \; (mod \; 13)\]
    .