การแก้ระบบสมการเชิงเส้นโดยใช้เมทริกซ์

ยอดวิว 0

แบบฝึกหัด

EASY

การแก้ระบบสมการเชิงเส้นโดยใช้เมทริกซ์

MEDIUM

การแก้ระบบสมการเชิงเส้นโดยใช้เมทริกซ์

HARD

การแก้ระบบสมการเชิงเส้นโดยใช้เมทริกซ์

เนื้อหา

ระบบสมการเชิงเส้น (Systems of Linear Equations)

สมการเชิงเส้น (Linear Equations)

สมการที่เขียนในรูป ax + by =c เมื่อ a, b, c เป็นจำนวนจริง เรียกว่าสมการเชิงเส้นที่มีตัวแปร 2 ตัว คือ x และ y ซึ่งจะเป็นสมการเส้นตรง ส่วน ax + by + cz = d โดยที่ a, b, c และ d เป็นจำนวนจริง จะเป็นสมการเชิงเส้น 3 ตัวแปร คือ x, y และ z ซึ่งสมการ 3 ตัวแปรนี้จะเป็นสมการของระนาบ

รูปทั่วไปของสมการเชิงเส้น n  ตัวแปรคือ
a subscript 1 x subscript 1 plus a subscript 2 x subscript 2 plus horizontal ellipsis plus a subscript n x subscript n equals b subscript n
เมื่อ a subscript 1 comma end subscript a subscript 2 comma horizontal ellipsis a subscript nและ b subscript n เป็นจำนวนจริง และ x subscript 1 comma x subscript 2 comma horizontal ellipsis comma x subscript nเป็นตัวแปร

ระบบสมการเชิงเส้น จะประกอบด้วยสมการเชิงเส้น m สมการ และมีตัวแปร n ตัว เขียนได้ในรูปทั่วไปดังนี้

table row cell a subscript 11 x subscript 1 plus end cell cell a subscript 12 x subscript 2 plus end cell cell midline horizontal ellipsis plus end cell cell a subscript 1 n end subscript x subscript n equals end cell cell b subscript 1 end cell row cell a subscript 21 x subscript 1 plus end cell cell a subscript 22 x subscript 2 plus end cell cell midline horizontal ellipsis plus end cell cell a subscript 2 n end subscript x subscript n equals end cell cell b subscript 2 end cell row vertical ellipsis vertical ellipsis blank vertical ellipsis vertical ellipsis row cell a subscript m 1 end subscript x subscript 1 plus end cell cell a subscript m 2 end subscript x subscript 2 plus end cell cell midline horizontal ellipsis plus end cell cell a subscript m n end subscript x subscript n equals end cell cell b subscript m end cell end table     (1)

เมื่อ a subscript 11 comma a subscript 12 comma horizontal ellipsis comma a subscript m n end subscript เป็นสัมประสิทธิ์ของตัวแปร x subscript 1 comma x subscript 2 comma horizontal ellipsis comma x subscript n และ b subscript 1 comma end subscript b subscript 2 comma horizontal ellipsis comma b subscript mเป็นค่าคงที่ของระบบ
เราสามารถเขียนระบบสมการเชิงเส้น (1) ในรูปเมตริกซ์ ได้ดังนี้ AX = B

โดยที่ A equals open square brackets a subscript i j end subscript close square brackets subscript m cross times n end subscriptเป็นเมตริกซ์สัมประสิทธิ์ (Coefficient Matrix)

X = open square brackets table row cell x subscript 1 end cell row cell x subscript 2 end cell row vertical ellipsis row cell x subscript n end cell end table close square brackets เป็นเมตริกซ์ของตัวแปร และ B = open square brackets table row cell b subscript 1 end cell row cell b subscript 2 end cell row vertical ellipsis row cell b subscript m end cell end table close square brackets เป็นเมตริกซ์ของค่าคงที่

หมายเหตุ
1.ถ้า B = 0 เรียกระบบสมการเชิงเส้น  นี้ว่าเป็นเอกพันธ์ (Homogeneous)
2.ถ้า B ≠ 0 เรียกระบบสมการเชิงเส้น  นี้ว่าไม่เป็นเอกพันธ์ (Non - Homogeneous)
3.ถ้าจำนวนสมการเท่ากับจำนวนตัวไม่ทราบค่า (m= n) เราเรียกระบบ Simultaneous Equation
4.ถ้าคำตอบของระบบสมการเชิงเส้น  หาค่าได้ เรียกระบบนี้ว่า ไม่ขัดแย้ง (Consistance)
5.ถ้าคำตอบของระบบสมการเชิงเส้น  หาค่าไม่ได้ เรียกระบบนี้ว่า ขัดแย้ง (Inconsistance)

คำตอบของระบบสมการเชิงเส้นใด อาจมีกรณีที่เป็นไปได้หนึ่งกรณี ดังนี้

1) ขัดแย้ง (Inconsistance)
2) มีคำตอบเพียง 1 ชุดเท่านั้น (Unique Solution)
3) มีคำตอบหลายชุดหรืออนันต์ (Infinite Solution)

ตัวอย่างของระบบสมการเชิงเส้นที่มี 2 สมการ 2 ตัวแปร ถ้ากราฟของสมการ เป็นเส้นตรง 2 เส้น ตัดกันเพียงจุดเดียว ดังรูป (ก) จะมีคำตอบเดียว ถ้ากราฟของสมการทั้ง 2 เป็นเส้นตรงเส้นเดียวกันดังรูป (ข) จะมีคำตอบมากมาย เป็นอนันต์ และถ้ากราฟของสมการทั้ง 2 เป็นเส้นตรงที่ขนานกัน ดังรูป (ค) จะไม่มีคำตอบ คือ เป็นสมการที่ขัดแย้งกัน

             (ก)                                      (ข)                                            (ค)


การหาคำตอบของระบบสมการเชิงเส้น n สมการ n ตัวแปร

จะกล่าวถึงวิธีการแก้สมการเชิงเส้นที่มีจำนวนสมการเท่ากับจำนวนตัวแปร 2 วิธี คือ

1. โดยใช้กฎของเครเมอร์
2. โดยใช้เมตริกซ์ผกผัน

กฎของเครเมอร์ (Cramer’s Rule) 

นายเกรบริล เครเมอร์ (Gabriel Cramer) นักคณิตศาสตร์ชาวสวิสเป็นผู้คิดค้นกฎการแก้ระบบสมการเชิงเส้นโดยใช้ดีเทอร์มินันต์ขึ้นเป็นคนแรก  การแก้ระบบสมการเชิงเส้น n สมการและมีตัวไม่ทราบค่า n ตัว

ซึ่งสามารถเขียนเป็นสมการเมตริกซ์ AX = B จะมีคำตอบจากสมการอย่างแน่นอน ถ้า det A 0

โดยที่จากสมการนี้สามารถหาได้ในรูปของดีเทอร์มินันต์ ดังตัวอย่างเช่น

จากสมการสองสมการมีตัวไม่ทราบค่าสองตัว
a subscript 11 x subscript 1 plus a subscript 12 x subscript 2 equals b subscript 1
a subscript 21 x subscript 1 plus a subscript 22 x subscript 2 equals b subscript 2     จะมีรากสมการดังนี้
x subscript 1 equals fraction numerator b subscript 1 a subscript 22 minus a subscript 12 b subscript 2 over denominator a subscript 11 a subscript 22 minus a subscript 12 a subscript 21 end fraction

และ x subscript 2 equals fraction numerator a subscript 11 b subscript 2 minus a subscript 21 b subscript 1 over denominator a subscript 11 a subscript 22 minus a subscript 12 a subscript 21 end fraction     open parentheses 2 close parentheses

โดยที่ a subscript 11 a subscript 22 minus a subscript 12 a subscript 21 not equal to 0 เลขตัวเศษและตัวส่วนใน (2) จะแสดงในรูปดีเทอร์มินันต์ เพื่อหารากสมการ (1) ได้ดังนี้
x subscript 1 equals fraction numerator open vertical bar table row cell b subscript 1 end cell cell a subscript 12 end cell row cell b subscript 2 end cell cell a subscript 22 end cell end table close vertical bar over denominator open vertical bar table row cell a subscript 11 end cell cell a subscript 12 end cell row cell a subscript 21 end cell cell a subscript 22 end cell end table close vertical bar end fraction  และ  x subscript 2 equals fraction numerator open vertical bar table row cell a subscript 11 end cell cell b subscript 1 end cell row cell a subscript 21 end cell cell b subscript 2 end cell end table close vertical bar over denominator open vertical bar table row cell a subscript 11 end cell cell a subscript 12 end cell row cell a subscript 21 end cell cell a subscript 22 end cell end table close vertical bar end fraction  
(3)
สำหรับระบบสมการเชิงเส้น n สมการ มีตัวไม่ทราบค่า n ตัว 
table row cell a subscript 11 x subscript 1 plus end cell cell a subscript 12 x subscript 2 plus end cell cell midline horizontal ellipsis space plus end cell cell a subscript 1 n end subscript x subscript n equals end cell cell b subscript 1 end cell row cell a subscript 21 x subscript 1 plus end cell cell a subscript 22 x subscript 2 end cell cell midline horizontal ellipsis space plus end cell cell a subscript 2 n end subscript x subscript n end cell cell b subscript 2 end cell row vertical ellipsis blank blank vertical ellipsis vertical ellipsis row cell a subscript n 1 end subscript x subscript 1 plus end cell cell a subscript n 2 end subscript x subscript 2 end cell cell midline horizontal ellipsis space plus end cell cell a subscript n n end subscript x subscript n end cell cell b subscript n end cell end table  (4)
สามารถเขียนให้อยู่ในรูปของสมการเมตริกซ์ ได้เป็น
open square brackets table row cell a subscript 11 end cell cell a subscript 12 end cell midline horizontal ellipsis cell a subscript 1 n end subscript end cell row cell a subscript 21 end cell cell a subscript 22 end cell midline horizontal ellipsis cell a subscript 2 n end subscript end cell row vertical ellipsis vertical ellipsis blank vertical ellipsis row cell a subscript n 1 end subscript end cell cell a subscript n 2 end subscript end cell midline horizontal ellipsis cell a subscript n n end subscript end cell end table close square brackets open square brackets table row cell x subscript 1 end cell row cell x subscript 2 end cell row vertical ellipsis row cell x subscript n end cell end table close square brackets equals open square brackets table row cell b subscript 1 end cell row cell b subscript 2 end cell row vertical ellipsis row cell b subscript n end cell end table close square brackets

หรือ AX = B
เนื่องจาก det A 0 ดังนั้นสามารถหา A to the power of negative 1 end exponent ได้

ซึ่งจะได้
 X equals A to the power of negative 1 end exponent B
             equals fraction numerator 1 over denominator open vertical bar A close vertical bar end fraction 
(adj A)B

ทำให้ได้    x subscript i fraction numerator A subscript 1 i end subscript b subscript 1 over denominator open vertical bar A close vertical bar end fraction plus fraction numerator A subscript 2 i end subscript b subscript 2 over denominator open vertical bar A close vertical bar end fraction plus midline horizontal ellipsis fraction numerator A subscript n i end subscript b subscript n over denominator open vertical bar A close vertical bar end fraction semicolon i equals 1 comma 2 comma midline horizontal ellipsis comma n
ให้ A subscript i เป็นเมตริกซ์ที่ได้มาจากการแทนที่หลักที่ i ของเมตริกซ์ A ด้วยเมตริกซ์ B นั่นคือ 
A subscript i=

โดยใช้หลักที่ i ของเมตริกซ์ A subscript i กระจายโคแฟคเตอร์ หรือหา open vertical bar A subscript i close vertical bar จะทำให้ได้open vertical bar A subscript i close vertical bar equals A subscript 1 i end subscript b subscript 1 plus A subscript 2 i end subscript b subscript 2 plus horizontal ellipsis plus A subscript n i end subscript b subscript n
  • ดังนั้นจะได้ x subscript i fraction numerator open vertical bar A subscript i close vertical bar over denominator open vertical bar A close vertical bar end fraction semicolon space i equals 1 comma 2 comma midline horizontal ellipsis comma n

ตัวอย่าง 1  จงใช้กฎของเครเมอร์หารากของสมการ
3 x subscript 1 plus 2 x subscript 2 plus x subscript 3 space space space space space space equals 7
x subscript 1 minus x subscript 2 plus 3 x subscript 3 space space space space space space space space equals 3
5 x subscript 1 plus 4 x subscript 2 minus 2 x subscript 3 space space space space equals 1

วิธีทำ 

เนื่องจาก

D e t space A space equals space open vertical bar table row 3 2 1 row 1 cell negative 1 end cell 3 row 5 4 cell negative 2 end cell end table close vertical bar equals 13

D e t space A subscript 1 space equals space open vertical bar table row bold 7 3 2 row bold 4 cell negative 1 end cell 3 row bold 1 4 cell negative 2 end cell end table close vertical bar equals space minus 39 


D e t space A subscript 2 space end subscript equals space open vertical bar table row 3 7 1 row 1 3 3 row 5 1 cell negative 2 end cell end table close vertical bar equals space 78

D e t space A subscript 3 equals space open vertical bar table row 3 2 7 row 1 cell negative 1 end cell 3 row 5 4 1 end table close vertical bar equals 52
  • ดังนั้นจะได้ x subscript 1 equals fraction numerator d e t space A subscript 1 over denominator d e t space A end fraction equals negative 3 space space
space x subscript 2 equals fraction numerator d e t space A subscript 2 over denominator d e t space A end fraction equals 6 space space
space x subscript 3 equals fraction numerator d e t space A subscript 3 over denominator d e t space A end fraction equals 4
หมายเหตุ  ระบบสมการเชิงเส้น n ตัวแปร n สมการ จะเลือกใช้กฎของเครเมอร์หารากของสมการของระบบเชิงเส้นที่ n ≤ 3 สำหรับ n ≥ 4 จะเป็นการยุ่งยากในการหาค่าของดีเทอมีนันต์

ถ้าระบบสมการเอกพันธ์ (Homogeneous) AX = 0 ที่มีตัวไม่รู้ค่า n ตัว และ det(A) 0 แล้วจะได้ว่า ระบบสมการเอกพันธ์มีคำตอบเพียงชุดเดียวเท่านั้น คือ x subscript 1 equals 0 comma x subscript 2 equals 0 comma horizontal ellipsis comma x subscript n equals 0 เรียกคำตอบนี้ว่า
คำตอบที่สำคัญน้อย (Trivial Solution) 

ตัวอย่าง 2 จงแก้ระบบสมการ
  x subscript 1 plus 2 x subscript 2 minus 3 x subscript 3 space end subscript equals 0
2 x subscript 1 plus 5 x subscript 2 plus 2 x subscript 3 equals 0
3 x subscript 1 minus x subscript 2 minus 4 x subscript 3 equals 0

วิธีทำ
เนื่องจากเป็นสมการเอกพันธ์ ซึ่ง d e t open parentheses A close parentheses equals open vertical bar table row 1 2 cell negative 3 end cell row 2 5 2 row 3 cell negative 1 end cell cell negative 4 end cell end table close vertical bar equals 46
และ D e t space left parenthesis A subscript 1 right parenthesis equals open vertical bar table row 0 2 cell bold minus bold 3 end cell row 0 5 bold 2 row 0 cell negative 1 end cell cell bold minus bold 4 end cell end table close vertical bar equals 0
และ d e t left parenthesis A subscript 2 right parenthesis equals d e t left parenthesis A subscript 3 right parenthesis equals 0 
  • ดังนั้น ระบบสมการนี้มีคำตอบคือ x subscript 1 equals x subscript 2 equals x subscript 3 equals 0

ถ้าระบบสมการไม่เป็นเอกพันธ์ (Non - Homogeneous) AX = B โดยที่ det(A) = 0 และ 
d e t open parentheses A subscript j close parentheses not equal to 0 ; j = 1,2,…,n แล้วจะได้ว่า ระบบสมการไม่มีคำตอบ


ตัวอย่าง  3 จงแก้ระบบสมการ
x + y = 1
x + y = 0

วิธีทำ
สมการในรูปของเมตริกซ์ คือ open square brackets table row 1 1 row 1 1 end table close square brackets open square brackets table row x row y end table close square brackets equals open square brackets table row 1 row 0 end table close square brackets
เป็นสมการไม่เอกพันธ์ ที่มี d e t open parentheses A close parentheses equals open vertical bar table row 1 1 row 1 1 end table close vertical bar equals 0

และ d e t open parentheses A subscript 1 close parentheses equals open vertical bar table row 1 1 row 0 1 end table close vertical bar equals 1 comma space space
space d e t open parentheses A subscript 2 close parentheses equals open vertical bar table row 1 1 row 1 0 end table close vertical bar equals negative 1
  • ดังนั้น ระบบสมการนี้ไม่มีคำตอบ

การแก้ระบบสมการเชิงเส้นโดยใช้เมตริกซ์ผกผัน

จากระบบสมการ AX = B
ถ้า A มีอินเวอร์สจะได้  A to the power of negative 1 end exponent open parentheses A X close parentheses equals A to the power of negative 1 end exponent B
open parentheses A to the power of negative 1 end exponent A close parentheses X equals A to the power of negative 1 end exponent B
I subscript n X space space space space space space space space equals A to the power of negative 1 end exponent B
X space space space space space space space space space space space equals A to the power of negative 1 end exponent B
หมายเหตุ  การหาคำตอบโดยวิธีนี้จะต้องตรวจสอบให้แน่ชัดก่อนว่า A เป็น Non-Singular Matrix หรือไม่ และถ้าเป็น จะต้องหา A to the power of negative 1 end exponent ให้ได้เสียก่อน แล้วจึงจะได้คำตอบ x

ตัวอย่าง  4 จงแก้ระบบสมการ
3 x subscript 1 minus 4 x subscript 2 plus 8 x subscript 3 space space equals 26
6 x subscript 1 plus 3 x subscript 2 minus 5 x subscript 3 space space equals 1
minus 2 x subscript 1 plus x subscript 2 plus 3 x subscript 3 space equals 11

วิธีทำ  จากระบบสมการที่กำหนดให้ จะได้ว่า
A equals open square brackets table row 3 cell negative 4 end cell 8 row 6 3 cell negative 5 end cell row cell negative 2 end cell 1 3 end table close square brackets comma space
space B equals open square brackets table row 26 row 1 row 11 end table close square brackets comma space space X equals open square brackets table row cell x 1 end cell row cell x 2 end cell row cell x 3 end cell end table close square brackets

และ d e t open parentheses A close parentheses equals open vertical bar table row 3 cell negative 4 end cell 8 row 6 3 cell negative 5 end cell row cell negative 2 end cell 1 3 end table close vertical bar equals 170 not equal to 0 
แสดงว่า A เป็นเมตริกซ์ Non-Singular

therefore A to the power of negative 1 end exponent equals fraction numerator a d j open parentheses A close parentheses over denominator d c t open parentheses A close parentheses end fraction equals 1 over 170 open square brackets table row 14 20 cell negative 4 end cell row cell negative 8 end cell 25 63 row 12 5 33 end table close square brackets
  • คำตอบคือ X equals A to the power of negative 1 end exponent B

open square brackets table row cell x 1 end cell row cell x 2 end cell row cell x 3 end cell end table close square brackets equals 1 over 170 open square brackets table row 14 20 cell negative 4 end cell row cell negative 8 end cell 25 63 row 12 5 33 end table close square brackets open square brackets table row 26 row 1 row 11 end table close square brackets
space space space space space space space space space equals 1 over 170 open square brackets table row 340 row 510 row 680 end table close square brackets equals open square brackets table row 2 row 3 row 4 end table close square brackets



ทีมผู้จัดทำ