Định lý đường trung bình — ทฤษฎีเส้นกึ่งกลางสามเหลี่ยม
Định lý đường trung bình (Midsegment Theorem) หรือทฤษฎีเส้นกึ่งกลางของสามเหลี่ยม เป็นทฤษฎีพื้นฐานในเรขาคณิต ระบุว่า เส้นตรงที่ลากเชื่อมจุดกึ่งกลางของด้านสองด้านของสามเหลี่ยม จะขนานกับด้านที่สาม และมีความยาวเท่ากับครึ่งหนึ่งของด้านที่สาม ทฤษฎีนี้มีประโยชน์มากในการพิสูจน์ทางเรขาคณิต การคำนวณความยาวด้าน และการประยุกต์ใช้ในคอมพิวเตอร์กราฟิกส์ บทความนี้อธิบายทฤษฎีอย่างละเอียดพร้อม Python code สำหรับคำนวณและพิสูจน์
ทฤษฎีเส้นกึ่งกลาง (Midsegment Theorem)
# midsegment.py — Midsegment theorem explanation
import json
class MidsegmentTheorem:
THEOREM = {
"statement": {
"thai": "เส้นที่ลากเชื่อมจุดกึ่งกลางของด้านสองด้านของสามเหลี่ยม จะขนานกับด้านที่สาม และยาวเท่ากับครึ่งหนึ่งของด้านที่สาม",
"vietnamese": "Đường trung bình của tam giác song song với cạnh đáy và bằng nửa cạnh đáy",
"english": "The midsegment of a triangle is parallel to the third side and half its length",
},
"formula": {
"description": "ถ้า M เป็นจุดกึ่งกลางด้าน AB และ N เป็นจุดกึ่งกลางด้าน AC",
"result_1": "MN ∥ BC (ขนานกับด้าน BC)",
"result_2": "MN = BC / 2 (ยาวครึ่งหนึ่งของ BC)",
},
"converse": "ถ้าเส้นตรงผ่านจุดกึ่งกลางของด้านหนึ่งและขนานกับด้านที่สอง → ผ่านจุดกึ่งกลางของด้านที่สามด้วย",
}
PROPERTIES = [
"สามเหลี่ยมมี midsegments 3 เส้น (เชื่อมจุดกึ่งกลางทุกคู่)",
"Midsegments 3 เส้น แบ่งสามเหลี่ยมออกเป็น 4 สามเหลี่ยมเท่ากัน",
"สามเหลี่ยมเล็ก 4 รูปที่ได้ congruent กัน (เท่ากันทุกด้าน)",
"พื้นที่สามเหลี่ยมเล็กแต่ละรูป = 1/4 ของพื้นที่สามเหลี่ยมใหญ่",
"Midsegment triangle คล้ายสามเหลี่ยมเดิม อัตราส่วน 1:2",
]
def show_theorem(self):
print("=== Midsegment Theorem ===\n")
for lang, text in self.THEOREM["statement"].items():
print(f" [{lang}] {text}")
print(f"\n Formula:")
for key, val in self.THEOREM["formula"].items():
print(f" {val}")
def show_properties(self):
print(f"\n=== Properties ===")
for prop in self.PROPERTIES:
print(f" • {prop}")
thm = MidsegmentTheorem()
thm.show_theorem()
thm.show_properties()
Python พิสูจน์และคำนวณ
# proof.py — Python proof and calculation
import json
import math
class MidsegmentCalculator:
CODE = """
# midsegment_calc.py — Calculate and verify midsegment theorem
import math
import numpy as np
class Triangle:
def __init__(self, A, B, C):
'''สร้างสามเหลี่ยมจาก 3 จุด (x, y)'''
self.A = np.array(A, dtype=float)
self.B = np.array(B, dtype=float)
self.C = np.array(C, dtype=float)
def midpoint(self, P1, P2):
'''หาจุดกึ่งกลางของ 2 จุด'''
return (P1 + P2) / 2
def distance(self, P1, P2):
'''หาระยะทางระหว่าง 2 จุด'''
return np.linalg.norm(P2 - P1)
def midsegments(self):
'''คำนวณ midsegments ทั้ง 3 เส้น'''
M_AB = self.midpoint(self.A, self.B) # จุดกึ่งกลาง AB
M_BC = self.midpoint(self.B, self.C) # จุดกึ่งกลาง BC
M_AC = self.midpoint(self.A, self.C) # จุดกึ่งกลาง AC
return {
'MN (mid AB to mid AC)': {
'endpoints': (M_AB.tolist(), M_AC.tolist()),
'length': self.distance(M_AB, M_AC),
'parallel_to': 'BC',
'BC_length': self.distance(self.B, self.C),
'ratio': self.distance(M_AB, M_AC) / self.distance(self.B, self.C),
},
'PQ (mid AB to mid BC)': {
'endpoints': (M_AB.tolist(), M_BC.tolist()),
'length': self.distance(M_AB, M_BC),
'parallel_to': 'AC',
'AC_length': self.distance(self.A, self.C),
'ratio': self.distance(M_AB, M_BC) / self.distance(self.A, self.C),
},
'RS (mid AC to mid BC)': {
'endpoints': (M_AC.tolist(), M_BC.tolist()),
'length': self.distance(M_AC, M_BC),
'parallel_to': 'AB',
'AB_length': self.distance(self.A, self.B),
'ratio': self.distance(M_AC, M_BC) / self.distance(self.A, self.B),
},
}
def verify_parallel(self, P1, P2, P3, P4):
'''ตรวจสอบว่า 2 เส้นขนานกัน (cross product = 0)'''
v1 = P2 - P1 # direction vector 1
v2 = P4 - P3 # direction vector 2
cross = v1[0] * v2[1] - v1[1] * v2[0]
return abs(cross) < 1e-10 # ถ้า cross product = 0 → ขนาน
def verify_theorem(self):
'''พิสูจน์ทฤษฎี midsegment สำหรับสามเหลี่ยมนี้'''
M_AB = self.midpoint(self.A, self.B)
M_AC = self.midpoint(self.A, self.C)
# 1. ตรวจสอบขนาน: MN ∥ BC
is_parallel = self.verify_parallel(M_AB, M_AC, self.B, self.C)
# 2. ตรวจสอบความยาว: MN = BC/2
mn_length = self.distance(M_AB, M_AC)
bc_length = self.distance(self.B, self.C)
is_half = abs(mn_length - bc_length / 2) < 1e-10
return {
'parallel': is_parallel,
'half_length': is_half,
'MN_length': round(mn_length, 4),
'BC_length': round(bc_length, 4),
'ratio': round(mn_length / bc_length, 4),
'theorem_verified': is_parallel and is_half,
}
def area(self):
'''พื้นที่สามเหลี่ยม (Shoelace formula)'''
return 0.5 * abs(
self.A[0] * (self.B[1] - self.C[1]) +
self.B[0] * (self.C[1] - self.A[1]) +
self.C[0] * (self.A[1] - self.B[1])
)
# ตัวอย่าง
tri = Triangle([0, 0], [6, 0], [2, 8])
print("=== Midsegment Verification ===")
result = tri.verify_theorem()
for key, val in result.items():
print(f" {key}: {val}")
print("\\n=== All Midsegments ===")
for name, data in tri.midsegments().items():
print(f" {name}: length={data['length']:.2f}, parallel to {data['parallel_to']} ({data[data['parallel_to']+'_length']:.2f}), ratio={data['ratio']:.4f}")
"""
def show_code(self):
print("=== Midsegment Calculator ===")
print(self.CODE[:600])
calc = MidsegmentCalculator()
calc.show_code()
ตัวอย่างการพิสูจน์
# examples.py — Proof examples
import json
import math
class ProofExamples:
COORDINATE_PROOF = """
# พิสูจน์ด้วยพิกัด (Coordinate Geometry Proof)
# กำหนด: สามเหลี่ยม ABC ที่ A(0,0), B(2a,0), C(2b,2c)
# M = จุดกึ่งกลาง AB = ((0+2a)/2, (0+0)/2) = (a, 0)
# N = จุดกึ่งกลาง AC = ((0+2b)/2, (0+2c)/2) = (b, c)
# พิสูจน์ MN ∥ BC:
# slope ของ MN = (c - 0) / (b - a) = c / (b - a)
# slope ของ BC = (2c - 0) / (2b - 2a) = 2c / 2(b - a) = c / (b - a)
# slope เท่ากัน → MN ∥ BC ✓
# พิสูจน์ MN = BC / 2:
# MN = sqrt((b-a)^2 + c^2)
# BC = sqrt((2b-2a)^2 + (2c)^2) = sqrt(4(b-a)^2 + 4c^2) = 2*sqrt((b-a)^2 + c^2)
# MN = BC / 2 ✓
"""
VECTOR_PROOF = """
# พิสูจน์ด้วยเวกเตอร์ (Vector Proof)
# กำหนด: สามเหลี่ยม ABC
# M = จุดกึ่งกลาง AB → OM = (OA + OB) / 2
# N = จุดกึ่งกลาง AC → ON = (OA + OC) / 2
# MN = ON - OM = (OA + OC)/2 - (OA + OB)/2 = (OC - OB)/2 = BC/2
# ดังนั้น:
# 1. MN = (1/2) BC → MN ขนาน BC (เป็น scalar multiple)
# 2. |MN| = (1/2)|BC| → ยาวครึ่งหนึ่ง
# พิสูจน์เสร็จสมบูรณ์ ✓
"""
NUMERIC_EXAMPLES = [
{
"name": "สามเหลี่ยม A(0,0) B(6,0) C(2,8)",
"BC": math.sqrt((6-2)**2 + (0-8)**2),
"midsegment": math.sqrt((6-2)**2 + (0-8)**2) / 2,
},
{
"name": "สามเหลี่ยม A(1,1) B(7,1) C(4,9)",
"BC": math.sqrt((7-4)**2 + (1-9)**2),
"midsegment": math.sqrt((7-4)**2 + (1-9)**2) / 2,
},
{
"name": "สามเหลี่ยมด้านเท่า A(0,0) B(10,0) C(5, 8.66)",
"BC": math.sqrt((10-5)**2 + (0-8.66)**2),
"midsegment": math.sqrt((10-5)**2 + (0-8.66)**2) / 2,
},
]
def show_coordinate_proof(self):
print("=== Coordinate Proof ===")
print(self.COORDINATE_PROOF[:500])
def show_vector_proof(self):
print("\n=== Vector Proof ===")
print(self.VECTOR_PROOF[:400])
def show_examples(self):
print(f"\n=== Numeric Examples ===")
for ex in self.NUMERIC_EXAMPLES:
print(f" [{ex['name']}]")
print(f" BC = {ex['BC']:.2f}")
print(f" Midsegment = {ex['midsegment']:.2f} (= BC/2 ✓)")
proofs = ProofExamples()
proofs.show_coordinate_proof()
proofs.show_vector_proof()
proofs.show_examples()
การประยุกต์ใช้
# applications.py — Applications of midsegment theorem
import json
class Applications:
MATH_APPS = {
"find_length": {
"name": "หาความยาวด้าน",
"example": "ถ้า midsegment ยาว 5 → ด้านที่ขนาน = 10",
},
"prove_parallel": {
"name": "พิสูจน์เส้นขนาน",
"example": "ถ้าเส้นผ่านจุดกึ่งกลาง 2 ด้าน → ขนานกับด้านที่ 3",
},
"area_ratio": {
"name": "อัตราส่วนพื้นที่",
"example": "Midsegment triangle มีพื้นที่ = 1/4 ของสามเหลี่ยมเดิม",
},
"centroid": {
"name": "จุดเซนทรอยด์",
"example": "Medians 3 เส้นตัดกันที่จุดเซนทรอยด์ แบ่ง median 2:1",
},
}
CS_APPS = {
"mesh_subdivision": {
"name": "Mesh Subdivision (Computer Graphics)",
"description": "แบ่ง triangle mesh ให้ละเอียดขึ้น โดยเชื่อม midpoints",
},
"collision_detection": {
"name": "Collision Detection (Game Physics)",
"description": "ใช้ midsegment approximation สำหรับ broad-phase collision",
},
"gis_interpolation": {
"name": "GIS Interpolation",
"description": "Triangulation + midsegment สำหรับ terrain interpolation",
},
"fractal": {
"name": "Sierpinski Triangle",
"description": "สร้าง fractal โดยเชื่อม midpoints ซ้ำๆ — สามเหลี่ยม Sierpinski",
},
}
def show_math(self):
print("=== Math Applications ===\n")
for key, app in self.MATH_APPS.items():
print(f" [{app['name']}] {app['example']}")
def show_cs(self):
print(f"\n=== Computer Science Applications ===")
for key, app in self.CS_APPS.items():
print(f" [{app['name']}] {app['description']}")
apps = Applications()
apps.show_math()
apps.show_cs()
Visualization
# visualization.py — Visualize midsegment theorem
import json
class MidsegmentVisualization:
CODE = """
# visualize_midsegment.py — Draw midsegment theorem
import matplotlib.pyplot as plt
import numpy as np
def draw_midsegment_theorem(A, B, C):
'''วาดสามเหลี่ยมพร้อม midsegments'''
A, B, C = np.array(A), np.array(B), np.array(C)
# Midpoints
M_AB = (A + B) / 2
M_BC = (B + C) / 2
M_AC = (A + C) / 2
fig, ax = plt.subplots(1, 1, figsize=(8, 6))
# Draw triangle
triangle = plt.Polygon([A, B, C], fill=False, edgecolor='blue', linewidth=2)
ax.add_patch(triangle)
# Draw midsegments
ax.plot([M_AB[0], M_AC[0]], [M_AB[1], M_AC[1]], 'r--', linewidth=2, label='MN ∥ BC')
ax.plot([M_AB[0], M_BC[0]], [M_AB[1], M_BC[1]], 'g--', linewidth=2, label='PQ ∥ AC')
ax.plot([M_AC[0], M_BC[0]], [M_AC[1], M_BC[1]], 'm--', linewidth=2, label='RS ∥ AB')
# Mark points
for point, name in [(A, 'A'), (B, 'B'), (C, 'C')]:
ax.plot(*point, 'bo', markersize=8)
ax.annotate(name, point, textcoords="offset points", xytext=(5, 5), fontsize=12)
for point, name in [(M_AB, 'M'), (M_BC, 'N'), (M_AC, 'P')]:
ax.plot(*point, 'ro', markersize=6)
ax.annotate(name, point, textcoords="offset points", xytext=(5, 5), fontsize=10)
ax.set_title('Midsegment Theorem')
ax.legend()
ax.set_aspect('equal')
ax.grid(True, alpha=0.3)
plt.savefig('midsegment_theorem.png', dpi=150, bbox_inches='tight')
plt.show()
# draw_midsegment_theorem([0, 0], [6, 0], [2, 8])
"""
def show_code(self):
print("=== Visualization Code ===")
print(self.CODE[:600])
viz = MidsegmentVisualization()
viz.show_code()
FAQ - คำถามที่พบบ่อย
Q: Midsegment Theorem ใช้กับรูปอื่นได้ไหม?
A: สี่เหลี่ยม: เชื่อม midpoints ของทุกด้าน → ได้สี่เหลี่ยมด้านขนาน (Varignon's Theorem) สามเหลี่ยม: ใช้ได้เสมอ — ทุกสามเหลี่ยมมี midsegments 3 เส้น 3D (Tetrahedron): เชื่อม midpoints ของ edges → ได้ octahedron หลักการเดียวกัน: เส้นเชื่อมจุดกึ่งกลาง → ขนานและยาวครึ่งหนึ่ง
Q: ทำไม midsegment ยาวครึ่งหนึ่ง?
A: พิสูจน์ง่ายที่สุดด้วยเวกเตอร์: MN = ON - OM = (OA+OC)/2 - (OA+OB)/2 = (OC-OB)/2 = BC/2 เนื่องจาก MN = (1/2)BC → ทิศทางเดียวกัน (ขนาน) + ขนาดครึ่งหนึ่ง เป็นผลโดยตรงจากการหารครึ่ง: จุดกึ่งกลางแบ่ง 2 ด้าน → เส้นเชื่อมแบ่ง ratio 1:2
Q: Midsegment Theorem เกี่ยวข้องกับ Similar Triangles อย่างไร?
A: Midsegment triangle (สามเหลี่ยมที่เกิดจากเชื่อม midpoints) คล้ายกับสามเหลี่ยมเดิม อัตราส่วนด้าน: 1:2 (midsegment = ครึ่งหนึ่งของด้านขนาน) อัตราส่วนพื้นที่: 1:4 (พื้นที่ midsegment triangle = 1/4 ของเดิม) มุมทุกมุมเท่ากัน — เพราะด้านขนานทำให้มุม corresponding เท่ากัน
Q: ข้อสอบมักออกแบบไหน?
A: แบบที่ 1: ให้ midsegment ยาว X → หาด้านที่ขนาน (× 2) แบบที่ 2: ให้ด้าน → หา midsegment (÷ 2) แบบที่ 3: พิสูจน์ว่าเส้นตรงขนาน โดยใช้ midsegment theorem แบบที่ 4: หาพื้นที่ midsegment triangle (÷ 4) เคล็ดลับ: จำว่า midsegment = ขนาน + ครึ่งหนึ่ง เสมอ
