Wikipedia:Reference desk/Archives/Mathematics/2015 December 16

= December 16 =

Whether to add to Linear Equation how to find the general form of a linear equation given two points
Hi everyone.

I constantly come to Wikipedia to find how to solve already solved problems, but the Linear Equation page failed me. I wanted to know how to find the general form of a two-dimensional linear equation given any two points (already solved; see later). The page only provides a solution for a point lying on the x-axis and another on the y-axis. I read several links from the first few pages of a Google search, but the only solution was to find the slope–intercept form and then transform to the general form. The problem is that this solution doesn't work for vertical lines. So, the solution, according to the internet, is to first test if it's a vertical line, and then choose the appropriate method. My limited mathematical skills tells me there should be a more generic approach, and I found it (still not the point of this question, read on):


 * To find the equation for a 2D line in the form $$Ax+By+C=0$$ that passes through points $$P=\left[\begin{matrix}p_x \\ p_y\end{matrix}\right]$$ and $$Q=\left[\begin{matrix}q_x \\ q_y\end{matrix}\right]$$.


 * $$A = \begin{cases}q_y - p_y & \quad p_x > q_x \\ p_y - q_y & \quad \text{otherwise} \end{cases}$$


 * $$B = \left| p_x - q_x \right|$$


 * $$C = - \left( A \cdot p_x \right) - \left( B \cdot p_y \right) = - \left( A \cdot q_x \right) - \left( B \cdot q_y \right)$$

By replacing x and y by the coordinates of a point, the value on the left hand side will be 0 if the point is on the line, a positive number if the point is on one side of the line, and a negative number if the point is on the other side of the line. One problem is that this number doesn't give the distance to the line, but I don't know if that's expected from the general form.

Now, the actual point of this question. I wanted to add this to the Linear Equation article. First thing I did was to consult the Talk:Linear_equation page. However, the first thing I found was "This is not a forum for general discussion of the article's subject.", and I suppose this issue would require a discussion. The second thing I found was "No original research", which is exactly what I did by comparing some points to the general form equation obtained from the slope–intercept form.

So, I want two things by leaving this here: for people to read it and decide whether it requires further action, and to leave this as a reference for if someone searches the same thing that I did. — Preceding unsigned comment added by GuiARitter (talk • contribs) 18:35, 16 December 2015 (UTC)

Edit: forgot to say I tested this with pairs of points with randomly generated coordinates between -7.0 and 7.0.


 * What you're looking for is already in the article, look for mentions of "determinant form". -- Meni Rosenfeld (talk) 19:08, 16 December 2015 (UTC)
 * Specifically, the article says that the line passing through $$(p_x,p_y),(q_x,q_y)$$ is given by

\begin{vmatrix} x&y&1\\ p_x&p_y&1\\ q_x&q_y&1 \end{vmatrix} =0\,.$$
 * In other words, $$(p_y-q_y)x+(q_x-p_x)y+(p_xq_y-p_yq_x)=0$$, which is equivalent to what you wrote, and simpler.
 * Also, to clarify, this question could fit perfectly in Talk:Linear equation. The first warning simply says the discussions must be aimed at improving the article, and by your account this is indeed your aim. The second warning means that the article shouldn't include things that you are the first to discover and that were not published anywhere else - your proposed addition is clearly already well known. (The problem, again, is that the article already includes this, so there is nothing to add. Good job deriving it independently, though). -- Meni Rosenfeld (talk) 19:16, 16 December 2015 (UTC)
 * Actually, the expansion of the determinant also appears in the article already - in the very row above the first one mentioning the determinant form. -- Meni Rosenfeld (talk) 19:25, 16 December 2015 (UTC)


 * Thanks for your response. Yeah, I see it now. As I said, my math skills are limited, so I didn't tried to find the determinant to see what would happen, and I skimmed the Two-point form sub(sub?)section because it involved the slope. So, maybe the article could be improved by adding $$(p_y-q_y)x+(q_x-p_x)y+(p_xq_y-p_yq_x)=0$$ to the General (or standard) form sub(sub?)section, but it doesn't seem that necessary anymore. Also, I saw your response accidentally because I came here to add something I forgot. So, I've just seen that the "Watch this page" feature doesn't work as I expected... GuiARitter (talk) 19:40, 16 December 2015 (UTC)
 * To see changes in pages you've watched, you need to go to your "watchlist" - the link is found at the top of the Wikipedia interface. I'm not sure how to get more active notifications for a page. Also, people can tag you so you get an active notification, as I've done now (but it's not customary in the RefDesk to tag people when answering). -- Meni Rosenfeld (talk) 21:12, 16 December 2015 (UTC)