Skip to main content

Perpendicular distance of a plane from the origin

Concept

We represent n dimension data and equation in machine learning using algebra as,

wT・x + w0 = 0

Where w = [w1 w2 ... wn] is normal of the plane or weights.
and x = [x1 x2 ... xn] is representation of features or dimension.

and we represent its distance from origin or perpendicular from origin to plane as -w0/|w|,

where, |w| = 

Let's see if this is true and imagine the case in 3D, (Beautifully generated by GeoGebra)

Plane in 3 Dimensions

Here we have taken the plane passing through three points A, B, and C but not from the origin. We have calculated the shortest or perpendicular distance from the origin.
We can represent 3D plane as ax + by + cz + d = 0 or,
w1x1 + w2x2 + w3x3 + w0 = 0.

a = w1 = -10.47
b = w2 = -4.85
c = w3 = -3
d = w0 = 25.42

distance = 2.13

Let's calculate the distance using the formula,
>import math
>print((25.42)/math.sqrt((10.47)**2+(4.85)**2+(3)**2))
>2.1321227126291182

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.