A midpoint is the exact middle point of a line segment. It divides the line into two equal parts. The midpoint formula is used to find the point exactly halfway between two points on a coordinate plane.
For a line segment AB in Cartesian coordinates where the x-axis coordinate of point A is x1 and the y-axis coordinate of point A is y1 and similarly, the x-axis coordinate of point B is x2 and the y-axis coordinate of point B is y2, the midpoint of the line will be given by (xm, ym).
The formula for the midpoint (xm, ym) is

Example: Find the coordinates of the midpoint of a line segment whose endpoints are (5, 6) and (-3, 4).
As we know, the midpoint of a line segment is given by the formula:
Midpoint = ((x1+x2)/2 , (y1+y2)/2)
where (x1, y1) and (x2, y2) are the coordinates of the endpoints of the line segment.
Midpoint = ((5+(-3))/2, (6+4)/2)
⇒ Midpoint = (2/2, 10/2)
⇒ Midpoint = (1, 5)
Therefore, the coordinates of the midpoint of the line segment are (1, 5).
Derivation
Let P(x1,y1) and Q(x2,y2) be the two ends of a given line in a coordinate plane, and R(x,y) be the point on that line which divides PQ in the ratio m1:m2 such that
PR/RQ = m1/m2 . . .(1)

Drawing lines PM, QN, and RL perpendicular on the x-axis and through R draw a straight line parallel to the x-axis to meet MP at S and NQ at T.
Hence from the figure, we can say:
SR = ML = OL - OM = x - x1 . . . (2)
RT = LN = ON - Ol = x2 - x . . . (3)
PS = MS - MP = LR - MP = y - y1 . . . (4)
TQ = NQ - NT = NQ - LR = y2 - y . . . (5)
Now triangle ∆SPR is similar to triangle ∆TQR.
Therefore,SR/RT = PR/RQ
By using equations 2, 3, and 1, we know:
x - x1 / x2 - x = m1 / m2
⇒ m2x - m2x1 = m1x2 - m1x
⇒ m1x + m2x = m1x2 + m2x1
⇒ (m1 + m2)x = m1x2 + m2x1⇒ x = (m1x2 + m2x1) / (m1 + m2)
Now triangle ∆SPR is similar to triangle ∆TQR,
Therefore,PS/TQ = PR/RQ
By using equations 4, 5, and 1, we know:
y - y1 / y2 - y = m1 / m2
⇒ m2y - m2y1 = m1y2 - m1y
⇒ m1y + m2y = m1y2 + m2y1
⇒ (m1 + m2)y = m1y2 + m2y1⇒ y = (m1y2 + m2y1) / (m1 + m2)
Hence the coordinates of R(x,y) are:
R(x, y) = (m1x2 + m2x1) / (m1 + m2), (m1y2 + m2y1) / (m1 + m2)
As we had to calculate the midpoint, therefore, we keep the values both of m1 and m2 as same i.e.
For the mid-point we know by the definition of mid-point, m1 = m2 = 1.
(x, y) = ((1.x2 + 1.x1) / (1 + 1), (1.y2 + 1.y1) / (1 + 1))x, y = (x2 + x1) / 2, (y2 + y1) / 2