What is the midpoint of the line segment from (X1, Y1)
to (X2, Y2)
?
graphInit({
range: 10,
scale: 20,
tickStep: 1,
labelStep: 1,
unityLabels: false,
labelFormat: function( s ) { return "\\small{" + s + "}"; },
axisArrows: "<->",
});
path([ [ X1, Y1 ], [ X2, Y2 ] ], {stroke:"#000000"});
style( point1Style );
label( [ X1, Y1 ], "(" + X1 + ", " + Y1 + ")",
getPos( [ X1,Y1 ], [ X2, Y2 ]) );
circle( [ X1, Y1 ], 0.15 );
style( point2Style );
label( [ X2, Y2 ], "(" + X2 + ", " + Y2 + ")",
getPos( [ X2,Y2 ], [ X1, Y1 ]) );
circle( [ X2, Y2 ], 0.15 );
(XM, YM)
The x coordinate of the midpoint is the average of the x coordinates X1
and X2
.
x = \dfrac{1}{2}(X1 + X2)
x = \dfrac{1}{2}(X1 + X2)
x = XM
style( midPtStyle );
graph.vert = path( [ [ XM, -10], [ XM, 10] ] );
The y coordinate of the midpoint is the average of the y coordinates Y1
and Y2
.
y = \dfrac{1}{2}(Y1 + Y2)
y = \dfrac{1}{2}(Y1 + Y2)
y = YM
graph.horiz = path( [ [ -10, YM], [ 10, YM ] ] );
The midpoint is (XM, YM)
.
circle( [ XM, YM ], 0.15 );
label( [ XM, YM ], "(" + XM + ", " + YM + ")",
getPos( [ XM, YM ], [ X1, Y1 ]) );
graph.vert.remove();
graph.horiz.remove();
The point (XM, YM)
is the midpoint of (X1, Y1)
and what point?
graphInit({
range: 10,
scale: 20,
tickStep: 1,
labelStep: 1,
unityLabels: false,
labelFormat: function( s ) { return "\\small{" + s + "}"; },
axisArrows: "<->",
});
style( point1Style );
label( [ X1, Y1 ], "(" + X1 + ", " + Y1 + ")",
getPos( [ X1,Y1 ], [ XM, YM ]) );
graph.first = circle( [ X1, Y1 ], 0.15 );
style( midPtStyle );
label( [ XM, YM ], "(" + XM + ", " + YM + ")",
getPos( [ XM, YM ], [ X1, Y1 ]) );
graph.midpoint = circle( [ XM, YM ], 0.15 );
(X2, Y2)
The average of the desired x coordinate and X1
should be XM
.
\dfrac{1}{2}(x + X1) = XM
Solving for x:
x + X1 = (2 * XM)
x = X2
style( point2Style );
graph.vert = path( [ [ X2, -10], [ X2, 10] ] );
The average of the desired y coordinate and Y1
should be YM
.
\dfrac{1}{2}(y + Y1) = YM
Solving for y:
y + Y1 = (2 * YM)
y = Y2
graph.horiz = path( [ [ -10, Y2 ], [ 10, Y2 ] ] );
The point (XM, YM)
is the midpoint of (X1, Y1)
and (X2, Y2)
.
path([ [ X1, Y1 ], [ X2, Y2 ] ], {stroke:"#000000"});
circle( [ X2, Y2 ], 0.15 );
label( [ X2, Y2 ], "(" + X2 + ", " + Y2 + ")",
getPos( [ X2, Y2 ], [ XM, YM ]) );
graph.first.toFront();
graph.midpoint.toFront();
graph.vert.remove();
graph.horiz.remove();