Goal
Construct a normalized A*x+B*y+C=0 line from two distinct two-dimensional Cartesian points, including vertical lines.
Worldwide context
Saved once here, used across the site.
Currency changes display only. Country selection guides tax input; no tax rate is guessed.
Construct a normalized A*x+B*y+C=0 line from two distinct two-dimensional Cartesian points, including vertical lines.
Use raw coefficients A=y1-y2, B=x2-x1, C=x1*y2-x2*y1, then divide all three by sqrt(A^2+B^2) and choose a positive-first normal sign.A clearer path to an answer
This page keeps the calculation transparent: define the goal, enter the matching values, inspect the method, and decide what the result means in your situation.
Construct a normalized A*x+B*y+C=0 line from two distinct two-dimensional Cartesian points, including vertical lines.
Point 1 x · Point 1 y · Point 2 x · Point 2 y
Use raw coefficients A=y1-y2, B=x2-x1, C=x1*y2-x2*y1, then divide all three by sqrt(A^2+B^2) and choose a positive-first normal sign.
Calculate, review the assumptions below, then compare a related tool when the decision needs more context.
Construct a normalized A*x+B*y+C=0 line from two distinct two-dimensional Cartesian points, including vertical lines.
Open the Line Equation From Two Points pageMore math tools
Download PDFDownload Word (.doc)
Enter your values above and choose Calculate to see the result here.
Calculation map
Use raw coefficients A=y1-y2, B=x2-x1, C=x1*y2-x2*y1, then divide all three by sqrt(A^2+B^2) and choose a positive-first normal sign.
Bounded, transparent calculation
Your recent runs stay in this browser session only.
Formula: Use raw coefficients A=y1-y2, B=x2-x1, C=x1*y2-x2*y1, then divide all three by sqrt(A^2+B^2) and choose a positive-first normal sign.
Two distinct points determine one line. The returned coefficients have unit normal length sqrt(A^2+B^2)=1 and satisfy A*x+B*y+C=0 for both points, with vertical lines represented directly rather than through an undefined slope.
Worked example: The normalized coefficients are A=0.7071067812, B=-0.7071067812, C=0, giving 0.7071067812*x-0.7071067812*y=0, equivalent to x-y=0.
The displayed limits are checked before the handler runs. Model-specific domain checks may also reject impossible or non-finite inputs.
Methodology: This calculator follows the WorldCalculate input, formula, precision, and boundary policy. Read the official methodology.
Calculator usage statistics
This section counts anonymous successful Calculate submissions, not unique visitors. Counts and top tools appear only when trusted aggregate data is available; country analysis is shown only under the same condition and reporting threshold.
Answer-first guide
Construct a normalized A*x+B*y+C=0 line from two distinct two-dimensional Cartesian points, including vertical lines. Start with one clearly defined goal, enter values in the units shown, and keep the result attached to the assumptions below.
This tool is useful when your question includes line equation, two points, standard line form. It returns the outputs declared in the calculator contract rather than a live quote, approval, diagnosis, or professional sign-off.
Point 1 x · Point 1 y · Point 2 x · Point 2 y. Keep the same time period, unit system, and currency wherever the form requires comparable values.
Run the worked example first, compare its output with the page's example, then change one input at a time. This makes an unexpected result easier to trace to a unit, boundary, or assumption.
Need a wider view? Browse Math Calculators or compare the related tools below. The WorldCalculate methodology explains how formulas, examples, limits, and revisions are reviewed.
Use raw coefficients A=y1-y2, B=x2-x1, C=x1*y2-x2*y1, then divide all three by sqrt(A^2+B^2) and choose a positive-first normal sign.
Two distinct points determine one line. The returned coefficients have unit normal length sqrt(A^2+B^2)=1 and satisfy A*x+B*y+C=0 for both points, with vertical lines represented directly rather than through an undefined slope.
The normalized coefficients are A=0.7071067812, B=-0.7071067812, C=0, giving 0.7071067812*x-0.7071067812*y=0, equivalent to x-y=0.
Context and background
Math calculators move from named quantities to a relation, then to a result that can be checked with substitution, units, or an alternate form.
Arithmetic, algebra, geometry, trigonometry, and number theory provide reusable structures for classroom work and everyday reasoning. Each page narrows that structure to one declared problem.
Research and review
Researched by Hassan ALRowaie, Founder and editorial researcher at WorldCalculate.
This guide follows the live calculator's declared inputs, formula, worked example, assumptions, validation boundaries, and source-backed methodology. The review date describes editorial review of the calculator explanation; it is not a promise that external facts or rates remain current.
A line through two distinct points can be written in several equivalent ways. This calculator chooses an implicit standard form, A*x+B*y+C=0, and normalizes the coefficients so the normal vector has length one. That choice gives a reproducible representation for ordinary sloped lines, horizontal lines, and vertical lines. The page accepts two ordered Cartesian points, rejects coincidence, and returns finite coefficients together with the equation text. It does not fit a line to noisy observations, infer a coordinate transformation, or divide by the horizontal change to force a slope. The guide explains the construction, sign convention, vertical-line behavior, checks, source boundary, assumptions, and conservative limits of this small analytic-geometry contract.
The returned object describes every point (x, y) satisfying A*x+B*y+C=0. The input points are used as two anchors, not as two measurements from which a regression is estimated. If the points are distinct, exactly one ordinary Euclidean line passes through them. The calculator returns the normalized coefficients and a readable equation so the result can be stored without choosing between slope-intercept notation and an undefined vertical slope case.
Equivalent equations can differ by a nonzero common factor. For example, x-y=0 and 2x-2y=0 describe the same set. Normalization removes that arbitrary scale by making sqrt(A^2+B^2)=1. There is still a sign ambiguity because multiplying every coefficient by -1 preserves the line, so this implementation selects the sign whose first nonzero normal coefficient is positive. The convention is mathematical housekeeping, not a claim that one orientation is physically preferred.
The four fields form point 1=(x1, y1) and point 2=(x2, y2). A coordinate must stay paired with its own point; moving y2 into the first point changes the geometry even when all four numbers are still valid. Negative and fractional coordinates are allowed within the displayed finite range. The form labels use coordinate units because no unit selector is present. If the points come from different drawings, scales, or coordinate frames, reconcile those choices before entering the values.
The handler repeats the numeric contract for direct calls. It accepts JavaScript numbers only, checks finiteness and bounds, and normalizes negative zero. It does not accept an expression such as 1+2, a string with a unit suffix, or a missing coordinate. These checks protect the coefficient products as well as the final equation. The bounds are deliberately broad enough for ordinary coordinate exercises while keeping browser arithmetic predictable; they are not a mathematical limit on lines.
A direction vector from the first point to the second is (x2-x1, y2-y1). A perpendicular normal can be chosen as (y1-y2, x2-x1). With C=x1*y2-x2*y1, the expression A*x+B*y+C vanishes at both input points. Substituting point 1 gives (y1-y2)x1+(x2-x1)y1+x1*y2-x2*y1=0 after cancellation. The same cancellation occurs for point 2. This is why the construction works without first calculating a slope.
The raw normal length is sqrt(A^2+B^2), which is nonzero exactly when the points are distinct. Dividing A, B, and C by that length preserves the zero set of the equation. The normalized normal can be interpreted as a unit perpendicular direction, but the page does not assign an orientation or signed distance meaning beyond the chosen sign convention. The C coefficient may be larger in magnitude than either normalized normal coefficient when the line is far from the origin, and that is expected.
For point 1=(0,0) and point 2=(2,2), the raw coefficients are A=-2, B=2, C=0. The raw normal length is sqrt(8), and the positive-first sign flips the result to A=1/sqrt(2), B=-1/sqrt(2), C=0. The normalized equation is approximately 0.7071067812*x-0.7071067812*y=0. Multiplying by sqrt(2) reveals the familiar x-y=0, but the normalized values are the canonical output requested by this page.
Substitution provides a direct check. At (0,0), both variable terms and C give zero. At (2,2), the two normalized variable contributions cancel. A horizontal example with (1,4) and (5,4) produces a normal with positive A and zero B, so the equation is x-1=0 after normalization. The examples show that the implicit form works even when the usual slope notation would use a zero denominator or a zero numerator.
A vertical line has x equal to one constant, so its slope is undefined in slope-intercept notation. The implicit form has no such problem. If the points are (3,-2) and (3,5), then the raw coefficients are A=-7, B=0, and C=21. The positive-first sign changes them to A=1, B=0, C=-3 after normalization, giving x-3=0. The returned equation is therefore a complete line representation rather than a failed slope calculation.
A horizontal line has y equal to one constant. For points (-4,6) and (2,6), the raw normal points vertically, and normalization gives A=0 and a positive B. The equation is y-6=0. The sign rule checks the first nonzero coefficient, so a zero A does not leave the output ambiguous: B is made positive. These axis-aligned cases are important regression examples because they exercise both the zero coefficient and positive-first branches.
The raw construction produces coefficients whose size depends on the distance between the two points. Doubling the point separation along the same line doubles A, B, and C, even though the geometric line is unchanged. Dividing by sqrt(A^2+B^2) removes that input-dependent scale from the normal. The normalized A and B therefore satisfy A^2+B^2=1 within floating-point precision. C is divided by the same length so the zero set is preserved.
Normalization is useful for comparison, but it does not make every coefficient small. A line far from the origin can have a C coefficient whose magnitude is larger than one because the unit normal still has to be offset to reach that line. The normalization also does not turn the equation into a segment, a ray, or a regression model. It only chooses one canonical scale for the same infinite line.
An implicit equation and its complete sign reversal describe the same line. Without a sign rule, two callers could calculate equivalent lines and receive coefficient triples that differ only by minus signs. This handler chooses the sign whose first nonzero normal coefficient is positive. If A is negative, all three values are reversed. If A is zero, B is inspected. C alone is never used to select the orientation because C is an offset, not a component of the two-dimensional normal.
The convention is deterministic even for lines through the origin. A line such as y=x can be returned as a positive A, negative B equation under the selected raw construction and then sign-adjusted consistently. The sign is not an arrow along the line and it is not a physical direction of travel. It is simply a stable representation rule for comparing or caching equations. A downstream application should preserve that meaning rather than assigning orientation semantics to the sign.
If point 1 and point 2 are identical, the direction vector is zero and no unique line is determined. There are infinitely many lines through one point, so returning an arbitrary equation would hide missing information. The handler rejects this case with the exact error `The two points must be distinct to define a line.` A point with one equal coordinate is not degenerate; only the complete ordered pairs must match. This distinction keeps ordinary horizontal, vertical, and diagonal cases valid.
Direct calls also reject non-number values, nonfinite values, and coordinates outside the displayed plus or minus 1,000,000 bounds. The form may prevent some invalid states, but the pure handler cannot rely on the browser. It does not parse arithmetic strings or silently clamp an input. Those choices make failures visible at the model boundary and prevent a malformed coordinate from becoming a plausible-looking normalized equation.
A basic verification is to substitute each original point into A*x+B*y+C. Both values should be zero apart from ordinary floating-point rounding. A second check is the normal length: calculate sqrt(A^2+B^2) from the returned numeric coefficients and confirm it is one within a suitable tolerance. A third check uses the displacement vector (x2-x1, y2-y1); its dot product with (A, B) should be zero because the normal is perpendicular to the line direction.
These checks test different properties. Point substitution verifies incidence, normalization verifies the scale convention, and the dot product verifies orientation perpendicularity. A result can pass one check while failing another if C is wrong, the divisor is omitted, or a coordinate is transposed. The readable equation is useful for a human review, while the separate numeric coefficients support automated tests without scraping formatted text.
For a nonvertical line, the normalized equation can be rearranged to y=mx+d when B is nonzero. The slope is -A/B and the intercept is -C/B. That rearrangement is useful for graphing, but it introduces a division that is unavailable when B=0. The implicit representation is therefore the primary contract here. It works uniformly for every valid pair and keeps the vertical branch explicit rather than forcing a special text-only slope result.
The two-point slope formula also has a different numerical presentation. It calculates (y2-y1)/(x2-x1), whereas this page first builds a normal from both differences and then normalizes it. Equivalent values can be shown with different decimal precision, and a rounded slope can make a line comparison less stable. Use the returned equation and coefficients for the canonical result; derive slope only when the receiving model explicitly requires it.
The coordinates have one shared unit, but A and B arise from coordinate differences and are normalized by a length. The displayed coefficient fields are labeled as coordinate units for accessible entry, while the normalized normal is dimensionless under a consistent coordinate scale and C carries the corresponding offset relationship. The page does not perform unit conversion. Mixing metres with millimetres can produce a syntactically valid line whose geometric meaning is wrong, so unit reconciliation belongs before calculation.
The finite bounds are software safeguards rather than restrictions on analytic geometry. With coordinates inside the range, the raw products and normalized coefficients remain within the handler's finite checks. The pure function checks raw A, B, C, the normal length, normalized values, and formatted equation components. Negative zero is normalized to zero so a line through an axis is not displayed with a misleading minus sign. Presentation precision does not change the underlying numeric values.
The catalog source is private formula provenance for the standard two-point line construction. This public article is original WorldCalculate writing and does not reproduce another site's page body, code, branding, defaults, or calculator data. A source reference can support the algebraic method, but it cannot tell the calculator what a visitor's coordinates mean, whether observations are exact, or whether a line is an appropriate model for a physical boundary.
The contract assumes a flat two-dimensional Cartesian system, two distinct finite points, and exact enough inputs for a direct construction. It excludes noisy-data regression, weighted fitting, uncertainty bands, coordinate transformations, curved paths, and segment clipping. If the points are measurements, report their uncertainty separately. If the desired object is a finite edge, use the two points and the returned line only as inputs to a separate segment or tolerance model.
Why not return only the slope? A vertical line has no finite slope, while the implicit equation handles it without an exception in the valid domain. Why are A and B sometimes decimals? Unit-normal normalization divides by the Euclidean normal length. Can I multiply the result by any nonzero number? Yes, the same zero set remains, but the calculator chooses one normalized scale for consistency. Why can C be negative? It records the offset needed for the line to pass through the supplied points and follows the chosen sign convention.
What happens if I reverse the point order? The raw normal may reverse, but the positive-first sign rule returns the same canonical coefficient orientation. What if the coordinates are very close but not identical? The formula still describes their exact connecting line within finite arithmetic, though measurement noise or floating-point conditioning may make the result sensitive. The conservative limit is simple: use this tool for a direct two-point line, and choose a fitting or uncertainty method when the points are observations rather than exact geometric anchors.
When A and B have unit length, the expression A*x+B*y+C has the signed-distance scale for a point relative to the line, provided the coordinate units and sign convention are interpreted consistently. A zero value means the point lies on the line. The positive or negative side depends on the chosen normal orientation, which is made deterministic by the positive-first rule but is not a physical direction. The handler returns this normalized form without accepting a test point or claiming a distance measurement for one.
The normalization makes comparisons between parallel lines easier because their normal coefficients use the same scale. Two parallel equations can differ in C and therefore represent different offsets, while their A and B values agree or differ by the documented sign convention. This observation is useful for analytic geometry, but it does not turn the two-point page into a distance-between-lines calculator. That would require a separate pair of lines and a clearly stated parallelism rule.
The normalized coefficients can be irrational-looking decimals even when the input coordinates are integers. The pure handler retains the finite JavaScript numbers and formats the equation with bounded significant precision for reading. A downstream system that needs exact rational or radical coefficients should preserve the original points and recompute with an appropriate symbolic representation. The display string is intended for explanation and rendering, not as a lossless interchange format.
When the input points are far from the origin or very close together, the C product and normal length may have different scales. Finite checks protect the declared range, but they do not supply an uncertainty model or a condition estimate. Use a consistent tolerance when testing substitution and do not compare rounded text as if it were exact. The stable part of the contract is the normalized construction from the finite point values, not a promise of arbitrary precision.
When this result is stored, keep the ordered source points, the normalized A, B, and C values, the displayed equation, and the positive-first convention together. The equation alone is mathematically sufficient to identify the line, but the source points explain how this record was constructed and make a later audit possible. The normalized coefficients are the preferred machine values; the formatted equation is the human-readable view and may be rounded for display.
A later workflow may use the line for plotting or substitution, but should state whether it needs an infinite line, a bounded segment, a distance relation, or a fitted trend. Those are different questions. This handler's stable output is valuable because it refuses to infer those extra meanings. Treat the model ID and assumptions as part of the data contract whenever the normalized line crosses a system boundary.
Construct a normalized A*x+B*y+C=0 line from two distinct two-dimensional Cartesian points, including vertical lines.
Use raw coefficients A=y1-y2, B=x2-x1, C=x1*y2-x2*y1, then divide all three by sqrt(A^2+B^2) and choose a positive-first normal sign. Two distinct points determine one line. The returned coefficients have unit normal length sqrt(A^2+B^2)=1 and satisfy A*x+B*y+C=0 for both points, with vertical lines represented directly rather than through an undefined slope.
Enter Point 1 x, Point 1 y, Point 2 x, Point 2 y, then choose Calculate.
Both points use one flat two-dimensional Cartesian coordinate system and compatible coordinate units. The points are exact finite inputs for this calculation; no best-fit line, uncertainty model, or outlier handling is performed. Normalization means unit normal length plus a deterministic sign in which the first nonzero normal coefficient is positive.
This calculator is part of the WorldCalculate library. Its formula, example, assumptions, input bounds, and output formatting follow the official methodology.
These WorldCalculate collections connect this tool with related questions while keeping each calculation separate and transparent.