Skip to main content

Equation of a line

Equation of line

y = mx + c or ax + by + c = 0 ?

Let's keep in mind that any line or plane in any dimension can be represented using below equation:

f = w1x1 + w2x2 +... + wnxn + w0

Where,  w1, w2, ..., ware coefficients of an object in a particular dimension. Which are represented as a, b, c in regular notation.
and x1, x2, ..., xn are dimensions that are represented as x, y, z in regular notation.

Let's try to get the equation of the below line, (Beautifully plotted using GeoGebra)

line

Above line can be represented in two ways,
  1. ax + by + c = 0 or w1x1 + w2x2 + w0 = 0
    x +2y -5 =0
  2. y = mx + c
    y = -0.5x + 2.5

which is better?

ax + by + c = 0 is always better than y = mx + c. Because it is a generalized form to represent a line or plan in any dimension. We can easily calculate slope or intercept with any axis or even normal vector using values of a, b, c.

X intercept = -c/a
Y intercept = -c/b
slope wrt x = -a/b
normal vector w =[a,b]
丄distance from origin = c/|w|
line

NOTE: c in y=mx+c is
y-intercept whereas in ax+by+c=0, y-intercept is -c/b.

Let's try to find these parameters in n-dimension,
f = w1x1 + w2x2 +... + wnxn + w0
x1 intercept = -w0 / w1
x2 intercept = -w0 / w2
.
.
xn intercept = -w0 / wn
normal vector w = [w1, w2, ..., wn]
丄distance from origin = -w0 / |w|, where |w| = 


Comments

Popular posts from this blog

Optima of a function

Optima of a function We all know that the differentiation of a function is zero at point x if the function is optimum (or saddle point) at x. We will try to see what does that means intuitively and using a graph. For more formulas on calculus check out my other blog. ( Calculus in AI and ML ) Theory: Single Variable Function: The function has optima at x if its first derivative equals 0 at x. We follow the below process to find the maxima or minima of a function. \[\begin{align*} &\text{For function } y=f(x),\\ &\text{1. Evaulate c where } \frac{\mathrm{d} y}{\mathrm{d} x}\mid_{x=c} = f'(c) = 0 \\ &\text{There can be more than one c where} f'(c)=0\\ &\text{2. For each c calculate } \frac{\mathrm{d^2} y}{\mathrm{d} x^2} = f''(c) \\ &\text{if }f''(c) \begin{cases} & <0 \text{ There is Maxima at c} \\ & >0 \text{ There is Minima at c} \\ & =0 \text{ Can't be determined} \end{cases} \end{align*}\] Intuition: Let&#

Basic Mathematics to kickstart Learning AIML

Mathematics is great It is great to start with basic mathematics and revise the concepts from school before diving into the world of AI. Keep in mind that everything in the world can be represented mathematically. Math is behind the magic you see in day to day life.