randRangeNonZero(-10, 10) randRangeNonZero(-10, 10) randRangeNonZero(-10, 10) randRangeNonZero(-10, 10) abs(X1 - X2)/2 abs(Y1 - Y2)/2 max(X1, X2) + X_MARGIN min(X1, X2) - X_MARGIN max(Y1, Y2) + Y_MARGIN min(Y1, Y2) - Y_MARGIN Y1 - Y2 X1 - X2 SLOPE_NUMERATOR / SLOPE_DENOMINATOR Y1 - (X1 * M)

The following line passes through point (X1, Y1):

y = fractionReduce(SLOPE_NUMERATOR, SLOPE_DENOMINATOR) x + b

What is the value of the y-intercept b?

b = (Y1 * SLOPE_DENOMINATOR - X1 * SLOPE_NUMERATOR) / SLOPE_DENOMINATOR

Substituting (X1, Y1) into the equation gives:

Y1 = fractionReduce(SLOPE_NUMERATOR, SLOPE_DENOMINATOR) \cdot X1 + b

Y1 = fractionReduce(X1 * SLOPE_NUMERATOR , SLOPE_DENOMINATOR) + b

b = Y1 - fractionReduce(X1 * SLOPE_NUMERATOR , SLOPE_DENOMINATOR)

b = fractionReduce(Y1 * SLOPE_DENOMINATOR - X1 * SLOPE_NUMERATOR, SLOPE_DENOMINATOR)

Plugging in fractionReduce(Y1 * SLOPE_DENOMINATOR - X1 * SLOPE_NUMERATOR, SLOPE_DENOMINATOR) for b, we get y = fractionReduce(SLOPE_NUMERATOR, SLOPE_DENOMINATOR) x + fractionReduce(Y1 * SLOPE_DENOMINATOR - X1 * SLOPE_NUMERATOR, SLOPE_DENOMINATOR).

graphInit({ range: max(abs(B) + 4, 11), scale: 220 / max(abs(B) + 4, 11), tickStep: ceil(max(abs(B) + 4, 11) / 11), labelStep: 1, unityLabels: false, labelFormat: function(s) { return "\\small{" + s + "}"; }, axisArrows: "<-&rt;" }); plot(function(x) { return M * x + B; }, [min((-abs(B) -5), -12) , max((abs(B) + 5), 12)], { stroke: "#28ae7b" }); circle([X1, Y1], 4 / 20, { stroke: "none", fill: "black" }); var p1Position = "above right"; if ((Y1 > Y2) && (X1 > X2)) { p1Position = "below right"; } else if ((Y1 > Y2) && (X1 < X2)) { p1Position = "below left"; } else if ((Y1 < Y2) && (X1 < X2)) { p1Position = "above left"; } label([X1, Y1], "(" + X1 + ", " + Y1 + ")", p1Position);
randRangeNonZero(-10, 10) randRangeNonZero(-10, 10) randRangeNonZero(-10, 10) Y_COEFF * Y_INTERCEPT

Given the line:

expr(["*", X_COEFF, "x"]) + expr(["*", Y_COEFF, "y"]) = EQUALS

What is the y-intercept?

\large(0,\ Y_INTERCEPT\large)

The y-intercept is the point where the line crosses the y-axis. This happens when x is zero.

Set x to zero and solve for y:

X_COEFF(0) + expr(["*", Y_COEFF, "y"]) = EQUALS

expr(["*", Y_COEFF, "y"]) = EQUALS

\dfrac{Y_COEFFy}{Y_COEFF} = \dfrac{EQUALS}{Y_COEFF}

y = Y_INTERCEPT

The line intersects the y-axis at (0, Y_INTERCEPT).

graphInit({ range: 11, scale: 20, tickStep: 1, labelStep: 1, unityLabels: false, labelFormat: function(s) { return "\\small{" + s + "}"; }, axisArrows: "<->" }); style({ stroke: BLUE }); plot(function(x) { return (-1 * X_COEFF / Y_COEFF) * x + EQUALS / Y_COEFF; }, [-11, 11]); circle([0, Y_INTERCEPT], 4 / 20, { stroke: BLUE, fill: BLUE }); label([0, Y_INTERCEPT], "(0, " + Y_INTERCEPT + ")", "right", { labelDistance: 5 });