Construct a Line Through Two Points and Find Its Slope

Construct a Line Through Two Points and Find Its Slope
Loading the math board and drawing, please wait…
2026-02-15 00:03
In collections Coordinate Geometry
This GeoGebra example demonstrates how a line in the Cartesian plane is determined by two selected points, while its slope and related linear-equation information are updated interactively. The key math ideas include the definition of slope, using two points to compute the slope, the graphical meaning of a linear function/straight line, and the correspondence between an equation and its diagram. Construction workflow: create points A and B with Point, build the line using Line (lineAB), and compute its slope with Slope (mAB). Use Textfield for user input and validation states (e.g., inputValid/inputCurrent and validA/validB/validC), then show feedback through UI objects such as btnValidate, showhint, showanswer, showsolution, and counters like tries/countCorrect/countQuestion. If multiple problem cases are generated, use Shuffle and Element to choose random coordinates and manage case selection via caseNum and related variables. Suitable for middle and high school topics such as linear functions, coordinate geometry, and slope-based line construction, and for interactive practice or guided inquiry.

GeoGebra Commands & Parameters

  1. Shuffle({1, 2, 3, 4, 5, 6, 7}) → allCaseNum, {5, 2, 1, 7, 3, 4, 6}
  2. Shuffle(Sequence[t, t, -6, 6, 1] \ {-1, 1}) → allCompX, {-2, 2, 6, -6, 5, 0, -5, 3, 4, -3, -4}
  3. Shuffle(Sequence[t, t, -6, 6, 1] \ {0, -1, 1}) → allCompY, {-4, 6, 3, -5, 2, 4, -6, -3, -2, 5}
  4. Shuffle(Join[Sequence[Sequence[(j, k), j, -10, 10, 1], k, -10, 10, 1]]) → bigGrid, {(0, -7), (-7, -7), (7, 5), (-6, 7), (2, 1), (1, -2), (-3, -9), (-5, 7), (-4, 3), (-3, 6), (2, -2), (-8, 0), (5, 7), (2, 3), (-8, 1), (10, -2), (4, 8), (-9, -4), (8, -6), (6, 5), (7, -7), (5, 8), (-3, 8), (-7, 9), (-2, 2), (5, 2), (10, -7), (2, -7), (0, -5), (4, 7), (-8, 4), (-4, -10), (9, 8), (8, -9), (-10, 8), (6, 1), (-3, -5), (-7, -9), (9, 5), (-8, -5), (8, 1), (6, 7), (-3, -2), (-9, -2), (-10, 5), (-10, -5), (5, 1), (10, 5), (0, 1), (8, 2), (1, -1), (9, 1), (4, -6), (-4, 10), (-8, 3), (-8, 5), (0, 5), (10, -4), (8, -2), (-8, -9), (2, 7), (0, 9), (8, 8), (3, -8), (5, -6), (4, 5), (-9, -10), (4, -1), (0, 6), (-4, -4), (-7, 5), (-2, 10), (-9, 2), (7, 4), (2, 9), (-8, 2), (7, 10), (-3, -10), (1, 6), (8, -5), (-1, 6), (1, -9), (8, -4), (4, 2), (1, -7), (-4, 5), (9, -8), (0, -2), (10, 7), (-2, -6), (4, -8), (9, -3), (2, 6), (-6, -8), (-10, -2), (-6, 1), (1, -4), (2, 5), (-6, -5), (-3, 10), (10, 9), (7, -1), (-7, 1), (10, -5), (-10, -8), (3, 7), (-10, 6), (9, -4), (6, -8), (-4, -9), (0, -10), (9, 9), (-10, 0), (8, -8), (4, -5), (7, -8), (-7, -1), (-5, 0), (-4, 9), (1, 5), (5, -9), (7, -2), (8, 7), (1, 2), (-10, -3), (-8, 8), (-7, 0), (5, -7), (-5, -7), (4, -3), (-9, 4), (3, -7), (3, 2), (8, -10), (-2, 1), (-5, 10), (-6, 3), (1, 10), (-1, -9), (-3, -1), (6, 4), (-2, 7), (3, -10), (-1, 5), (-9, 3), (-10, 3), (-2, -3), (-1, -1), (0, 4), (-3, 9), (4, -9), (-7, -4), (-9, -1), (-8, 9), (4, -7), (10, -3), (-3, 0), (4, -10), (-4, -2), (7, 1), (0, -8), (6, -1), (8, 6), (9, -5), (2, -6), (7, 6), (-9, 5), (-10, -1), (7, -4), (4, 3), (4, 6), (-6, -4), (6, 9), (-2, 8), (-9, 1), (-3, 1), (-1, 9), (-2, 5), (5, 9), (4, 1), (5, 3), (-2, 0), (8, 0), (5, 4), (6, -2), (-8, -10), (5, -4), (-5, 8), (-9, 8), (-7, 8), (-5, -2), (-4, 8), (-2, 4), (8, 3), (8, -7), (3, -5), (0, 3), (-3, -4), (-7, 10), (5, -5), (1, 7), (-1, 10), (3, -3), (-9, -9), (9, -1), (-9, 7), (2, -1), (0, -9), (-2, 3), (-7, -2), (6, -5), (0, 10), (-6, 8), (-7, -8), (1, -6), (5, -1), (1, -8), (-1, -5), (-10, -9), (-9, 9), (6, 0), (1, -10), (-3, -6), (8, 9), (-1, 1), (10, 6), (5, -3), (-10, 9), (-5, -6), (7, 3), (-3, -3), (-2, -10), (6, -3), (-1, 0), (0, 7), (0, -6), (-4, 4), (-6, 6), (4, -2), (6, -7), (9, 7), (5, 5), (-7, 6), (-1, 2), (4, 9), (10, 4), (-7, 4), (10, 0), (-10, -6), (3, 3), (-6, 2), (-4, 6), (-6, -3), (-9, -8), (-9, 0), (6, 6), (9, 3), (-10, 1), (6, -9), (-6, 5), (-2, 9), (6, -4), (10, -9), (1, 9), (-6, -10), (-4, 2), (-10, 7), (4, -4), (-7, 7), (-3, 4), (-8, -2), (9, -2), (6, 3), (9, 10), (-7, -10), (-5, -3), (-5, 9), (1, 4), (0, 8), (0, 2), (-6, -1), (5, 6), (-1, -8), (-5, -8), (-2, -1), (-6, -7), (1, 8), (-4, -5), (5, -10), (-9, -3), (5, -2), (-5, 6), (7, -10), (7, 0), (-4, -7), (-8, -3), (-1, -6), (10, 8), (2, -8), (-6, -9), (4, 4), (-5, -5), (-10, 10), (-9, 10), (9, -10), (0, -4), (1, -3), (5, 0), (2, -10), (-6, 10), (-8, -7), (3, -2), (-3, 2), (10, 3), (7, -5), (-8, 6), (-6, 9), (-5, 3), (2, 10), (2, 8), (-3, -7), (-5, 2), (-3, 7), (7, -9), (3, 9), (-4, 0), (7, 2), (-7, -5), (-9, 6), (6, 8), (-2, -2), (6, -6), (10, 2), (8, 4), (10, -10), (5, -8), (-6, -2), (0, -1), (3, 10), (-5, 1), (3, -1), (0, -3), (-3, 3), (-7, -6), (-1, -10), (8, -3), (9, -9), (2, 2), (6, 2), (-1, 3), (-6, 4), (10, 10), (-8, -4), (-10, -7), (2, 4), (1, 0), (-10, -10), (2, -5), (-6, -6), (3, 6), (-1, 8), (-1, -7), (-5, -4), (-7, 2), (2, -3), (2, 0), (-2, -9), (3, -4), (-9, -6), (8, 10), (-10, -4), (-2, -5), (3, 5), (9, -6), (5, 10), (-5, 5), (-4, -8), (-6, 0), (-8, 7), (9, 4), (-2, 6), (-8, -8), (-2, -7), (7, -6), (-1, 4), (1, 3), (-10, 4), (-4, -3), (-3, -8), (3, 4), (-4, 1), (-7, -3), (-4, -6), (7, -3), (1, -5), (3, 1), (1, 1), (2, -4), (-2, -8), (-2, -4), (-3, 5), (9, -7), (6, 10), (6, -10), (-8, 10), (4, 0), (-10, 2), (-8, -1), (10, 1), (4, 10), (-7, 3), (9, 2), (3, -6), (-4, -1), (10, -8), (-8, -6), (-5, -9), (10, -6), (3, -9), (-5, -1), (7, 9), (8, 5), (-1, 7), (9, 6), (-4, 7), (3, 8), (-1, -2), (7, 8), (-1, -4), (-9, -7), (-1, -3), (3, 0), (-9, -5), (2, -9), (7, 7), (10, -1), (8, -1), (-5, 4), (0, 0), (-5, -10), (9, 0)}
  5. Element(allCaseNum, Mod[countQuestion, Length[allCaseNum]] + 1) → caseNum
  6. Element(allCompX, Mod[countQuestion, Length[allCompX]] + 1) → compX
  7. Element(allCompY, Mod[countQuestion, Length[allCompY]] + 1) → compY
  8. Element(bigGrid, Mod[countQuestion, Length[bigGrid]] + 1) → V1
  9. Point(bigGrid) → A
  10. Point(bigGrid) → B
  11. Line(A, B) → lineAB
  12. Slope(lineAB) → mAB
  13. Textfield(inputB) → InputBoxB
  14. Corner(5) → layoutAppSize
  15. onboardingTextOffset(Corner[onboardingText, 1], Corner[onboardingText, 3], onboardingCase, Corner[1], Corner[3], Corner[5]) → OnboardingTextOffset
  16. Textfield(inputA) → InputBoxA
  17. Textfield(inputC) → InputBoxC
  18. Polygon(P1, Mirror[P1, yAxis], Mirror[P1, (0, 0)], Mirror[P1, xAxis]) → peep, f, g, h, i
  19. Segment((-10.8, 0), (10.8, 0)) → fakeX
  20. Segment((0, -10.8), (0, 10.8)) → fakeY
  21. Vector(V1, (0, 0)) → aniVec
  22. Translate(V1, Vector[(aniSli * aniVec)]) → V1T
  23. Translate(V2, Vector[(aniSli * aniVec)]) → V2T
  24. Vector((10, 0), (11.2, 0)) → arrowX
  25. Vector((0, 10), (0, 11.2)) → arrowy
  26. If(y(A) > y(B), (x(A), y(B)), (x(B), y(A))) → C
  27. If(y(A) > y(B), Segment[B, B + (aniSli * (C - B))], Segment[A, A + (aniSli * (C - A))]) → horProj
  28. If(y(A) > y(B), Segment[A, A + (aniSli * (C - A))], Segment[B, B + (aniSli * (C - B))]) → vertProj

AI Drawing Prompt Reference

Draw a line through two randomly selected points in the Cartesian plane and calculate its slope. First, plot the line connecting these two points. Then, compute and display the slope of the line. To enhance interactivity, add input boxes for users to enter the coordinates of the points, and use text fields to show validation states and feedback. Finally, include coordinate axes and a grid in the plot to clearly illustrate the positions of the line and points.
The prompt above was compiled from the original drawing commands and is for reference only.