randRangeNonZero(-10, 10) / 2 randRangeNonZero(-10, 10) / 2
randRangeNonZero(-16, 16) / 2 0.5 * (VERTEX_Y + DIR_Y)
0.25 / (Y1 - DIR_Y)
fractionReduce.apply(KhanUtil, toFraction(A, 0.001)) fractionReduce.apply(KhanUtil, toFraction(X1, 0.001)) fractionReduce.apply(KhanUtil, toFraction(Y1, 0.001)) fractionReduce.apply(KhanUtil, toFraction(VERTEX_Y, 0.001)) fractionReduce.apply(KhanUtil, toFraction(DIR_Y, 0.001))

Drag the focus and directrix to define a parabola with the equation:

\qquad y - PRETTY_Y1 = PRETTY_A(x - PRETTY_X1)^2.

graph.A = A; graph.X1 = X1; graph.Y1 = Y1; graphInit({ range: 10, scale: 20, tickStep: 1, labelStep: 1, axisArrows: "<->" }); addMouseLayer(); graph.directrix = addMovableLineSegment({ coordA: [0, -1], coordZ: [1, -1], snapY: 0.25, vertical: false, extendLine: true, normalStyle: { "stroke": KhanUtil.ORANGE, "stroke-width": 2 }, highlightStyle: { "stroke": KhanUtil.ORANGE, "stroke-width": 4 } }); graph.directrix.onMove = function(x, y) { var oldK = graph.currParabola.getDirectrixK(); var coord = this.coordA[1]; graph.currParabola.deltaFocusDirectrix(0, 0, coord - oldK); graph.updateValues(); }; graph.vertex = addMovablePoint({ coordX: 0, coordY: 1, snapX: 0.25, snapY: 0.25, }); graph.vertex.onMove = function(coordX, coordY) { var x = coordX - graph.currParabola.getFocusX(); var y = coordY - graph.currParabola.getFocusY(); graph.currParabola.deltaFocusDirectrix(x, y, 0); graph.updateValues(); }; style({ stroke: BLUE, strokeWidth: 3, fill: "none", clipRect:[[-10, -10], [20, 20]], arrows: null }); graph.updateValues = function() { redrawParabola(); var x = graph.currParabola.getVertexX(); var y = graph.currParabola.getVertexY(); var xText = x > 0 ? "" : "+"; var yText = y > 0 ? "" : "+"; xText += fractionReduce.apply(KhanUtil, toFraction(-x, 0.001)); yText += fractionReduce.apply(KhanUtil, toFraction(-y, 0.001)); var a = fractionReduce.apply(KhanUtil, toFraction(graph.currParabola.getLeadingCoefficient(), 0.001)); $("#focus-x-label").html("<code>{}" + xText + "</code>").tex(); $("#focus-y-label").html("<code>{}" + yText + "</code>").tex(); $("#directrix-label").html("<code>" + a + "</code>").tex(); }; graph.currParabola = new Parabola(0.25, 0, 0); graph.currParabola.plot(); graph.setXCoordinate = function() { graph.vertex.moveTo(X1, graph.currParabola.getFocusY()); }; graph.setSolution = function() { graph.setXCoordinate(); graph.vertex.moveTo(X1, graph.currParabola.getFocusY()); var k = DIR_Y - graph.currParabola.getDirectrixK(); graph.directrix.coordA = [0, DIR_Y]; graph.directrix.coordZ = [0, DIR_Y]; graph.directrix.transform(); graph.currParabola.deltaFocusDirectrix(0, 0, k); graph.vertex.moveTo(graph.currParabola.getFocusX(), VERTEX_Y); }
Drag the focus and directrix on the graph to match the equation.

Equation of the parabola:
y{}+0 {}={}\dfrac{1}{4} (x{}+0)^2

[ graph.currParabola.getVertexX(), graph.currParabola.getVertexY(), graph.currParabola.getLeadingCoefficient() ]
if (guess[0] === 0 && guess[1] === 0 && guess[2] === 0.25) { return ""; } return (abs(guess[0] - X1) < 0.001) && (abs(guess[1] - Y1) < 0.001) && (abs(guess[2] - A) < 0.001);

The equation is in the form y - y_1 = a(x - x_1)^2.

The leading coefficient, a, in the equation is PRETTY_A, which is positive. Therefore the parabola is upward opening.

The leading coefficient, a, in the equation is PRETTY_A, which is negative. Therefore the parabola is downward opening.

The value of x_1 is PRETTY_X1, what does this number mean for the parabola?

The minimum value of PRETTY_A(x - PRETTY_X1)^2 occurs when (x - PRETTY_X1)^2 = 0.

Therefore the vertex of the parabola is at x = PRETTY_X1.

The maximum value of PRETTY_A(x - PRETTY_X1)^2 occurs when (x - PRETTY_X1)^2 = 0.

Therefore the vertex of the parabola is at x = PRETTY_X1.

The focus of the parabola has the same x-coordinate as the vertex, so move the focus horizontally, so its x-coordinate is PRETTY_X1.

At x = PRETTY_X1, then y - PRETTY_Y1 = 0.

Therefore, the vertex of the parabola is at y = PRETTY_Y1. The focus and directrix should be an equal distance above and below this value.

The number in the denominator of a is twice the distance between the directrix to the focus. Therefore, the focus and directrix are separated by 1 / (2 * abs(A)) units.

The focus is therefore 1 / (4 * A) units above the vertex, and the directrix is 1 / (4 * A) units below the vertex.

The focus is therefore 1 / (4 * -A) units below the vertex, and the directrix is 1 / (4 * -A) units above the vertex.

The focus is at (PRETTY_X1, PRETTY_FOCUS_Y) and the directrix is at y = PRETTY_DIR_Y.