Suppose we have a linear equation and a point in the plane, then how can one determine on which side of the line the point lies?

Let your line be given by $ax+by=d$, and call $\vec n=(a,b)$ the normal vector of the line. Let's label the side $\vec n$ points to $+$ and the opposite side $-$. Then for any point $(x,y)$ in the plane, the sign of $$ax+by-d$$ determines which side the point $(x,y)$ is on. Notice that this is $0$ if and only if $(x,y)$ is on the line, so all points not on the line get $+$ or $-$.

Here's a picture illustrating the situation:

A line and its two sides

Edit: Oops, the equation should be $ax+b\color{red}{y}=d$ of course...

Are you meaning that you have a point $(x_0,y_0)$ and a line $y=a+b x$ ? If this is the case, compute $y_*=a+b x_0$ and compare $y_*$ to $y_0$. If $y_0 \gt y_*$, then the point is above the line; if $y_0 \lt y_*$, then the point is below the line; If $y_0 = y_*$, then the point is along the line.

Suppose the line is

$$ax+by+c=0\iff y=-\frac abx-\frac cb\;,\;\;b\neq 0\;\;(b=0\;\;\text{is a vertical line and a trivial case})$$

This means a point on the plane is on this straight line iff it is of the form $\;\left(x\,,\,-\frac abx-\frac cb\right)\;$ .

Well, now take a general point $\;P=(\alpha\,,\,\beta)\;$ on the plane , and then

$$\begin{align*}\beta<-\frac ac\alpha-\frac cb&\implies P\;\;\text{is on the left half plane of the line}\\ \beta>-\frac ac\alpha-\frac cb&\implies P\;\;\text{is on the right half plane of the line}\\ \beta=-\frac ac\alpha-\frac cb&\implies P\;\;\text{is on the line}\end{align*}$$

  • This doesn't make much sense, you're not picking any "side" of your hyperplane this way. – Olivier Bégassat Apr 17 '14 at 10:51
  • Am I not, @OlivierBégassat? Then what does "on the left...on the right" mean? When one draws a line on a given plane with the usual convention of axis, there is always "a left" and "a right" of that line (unless it is a horizontal line $\;y=k=$a constant, a particular case easily dealt with). – DonAntonio Apr 17 '14 at 10:53
  • My bad, I got confused and for a moment ^^ – Olivier Bégassat Apr 17 '14 at 10:59

Here's a strategy that's independent of how the equation is written.

  • Substitute your point ($P$) into the line equation. If equality still holds, then (of course) $P$ lies on the line, and you're done. Otherwise,

  • Substitute the origin, $O(0,0)$, into the equation. If $P$ and $O$ violate the equality in the same way (eg, both points making the left-hand side of the equation larger than the right-hand side, or both making the right-hand side larger than the left-hand side), then $P$ and $O$ are on the same side of the line; otherwise, the points are on opposite sides of the line.

Note that this strategy works for curves other than lines.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.