SlideShare a Scribd company logo
連立一次方程式
前田賢輝
2022/4/14 作成
2022/4/25 最終更新
目次
• ガウスの消去法
• 逆行列を使った方法
• 最小二乗法による近似解
ガウスの消去法
ガウスの消去法
例として以下の連立一次方程式を考える。
𝑥0 + 3𝑥1 − 2𝑥2 = 4
−𝑥0 + 6𝑥2 = −3
2𝑥0 + 12𝑥1 + 6𝑥2 = 10
ガウスの消去法では2つの操作
・ある式を定数倍して、別のある式に足すまたは引く
・ある式と別のある式を交換する
を行って解を求める。
計算は行列表現
1 3 −2
−1 0 6
2 12 6
𝑥0
𝑥1
𝑥2
=
4
−3
10
で進める。
Forward
1 3 −2
−1 0 6
2 12 6
𝑥0
𝑥1
𝑥2
=
4
−3
10
式0を式1に足し、式0を2倍して式2から引く。
1 3 −2
0 3 4
0 6 10
𝑥0
𝑥1
𝑥2
=
4
1
2
式1を式2から引く。
1 3 −2
0 3 4
0 0 2
𝑥0
𝑥1
𝑥2
=
4
1
0
これで𝑥2が求まった。
行列の左下を0にするこの処理をForwardと呼ぶ。
Backward
1 3 −2
0 3 4
0 0 2
𝑥0
𝑥1
𝑥2
=
4
1
0
式2を2倍して式1から引き、 式2を式0に足す。
1 3 0
0 3 0
0 0 2
𝑥0
𝑥1
𝑥2
=
4
1
0
式1を式0から引く。
1 0 0
0 3 0
0 0 2
𝑥0
𝑥1
𝑥2
=
3
1
0
式1を
1
3
倍し、式2を
1
2
倍する。
1 0 0
0 1 0
0 0 1
𝑥0
𝑥1
𝑥2
=
3
1
3
0
これで𝑥0, 𝑥1, 𝑥2が求まった。
行列の右上を0にするこの処理をBackwardと呼ぶ。
ピボティング
Forward中に以下のような場面に遭遇することがある。
1 4 0 2
0 0 5 3
0 1 0 −2
0 2 −1 5
𝑥0
𝑥1
𝑥2
𝑥3
=
3
−2
0
1
1行1列の値が0なので、このままではForwardを進めることができない。
そこで、1行目と3行目を交換する。
1 4 0 2
0 2 −1 5
0 1 0 −2
0 0 5 3
𝑥0
𝑥1
𝑥2
𝑥3
=
3
1
0
−2
これで、Forwardを進められるようになった。
この処理は通常、i列のi以降の行の中で最大の絶対値を持つものがi行に来るようにして行われる。
この処理をピボティングという。
特殊なパターン
ガウスの消去法を実施した結果、以下のようになったとする。
1 4 0 0
0 0 5 0
0 0 0 −2
0 0 0 0
𝑥0
𝑥1
𝑥2
𝑥3
=
𝑎
𝑏
𝑐
𝑑
この場合、 𝑑 = 0なら解が存在し、 𝑑 ≠ 0なら解が存在しない。
解が存在する場合、𝑥2 =
b
5
, 𝑥3 = −
𝑐
2
であり、 𝑥0, 𝑥1 は無数に存在する。
一般的に、
・係数がすべて0の行がある場合、その行の右辺が0でなければ解が存在しない。
・j列以外すべての係数が0である行がある場合、𝑥𝑗が定まる。
・係数が0でない列を複数持つ行がある場合、その列に対応する𝑥𝑗は無数に存在する。
正方行列でない場合
行数<列数の場合
行数以上の変数を定めることはできないので、行数<列数の場合、
解は存在しないか無数に存在する。
行数>列数の場合
解が存在するかどうかを決める式が必ず現れる。
後述するように、解が存在しない場合も最小二乗法による近似解が求まる場合がある。
ただし、一部の変数が無数に解を持つ場合は近似解も無数に存在する。
逆行列を使った方法
逆行列を使った方法
連立一次方程式𝐴𝑥 = 𝑏の𝐴が正方行列の場合は逆行列を使って解く方法もある。
𝐴が逆行列を持つ場合、解は𝑥 = 𝐴−1𝑏である。
𝐴が逆行列を持つこととガウスの消去法がうまく行く(単位行列にできる)ことは同値である。
最小二乗法による近似解
最小二乗法による近似解
連立方程式を右辺が0になるように変形する。
𝑎11𝑥1 + 𝑎12𝑥2 − 𝑏1 = 0
𝑎21𝑥1 + 𝑎22𝑥2 − 𝑏2 = 0
𝑎31𝑥1 + 𝑎32𝑥2 − 𝑏3 = 0
それぞれの方程式の2乗を誤差として、連立方程式全体の誤差𝑆を以下のように定義する。
𝑆 =
𝑖
𝑎𝑖1𝑥1 + 𝑎𝑖2𝑥2 − 𝑏 2
解では𝑆が最小となるはずだから、 𝑆の𝑥𝑗による偏微分は0となる。
𝜕𝑆
𝜕𝑥1
=
𝜕𝑆
𝜕𝑥2
= 0
最小二乗法による近似解
これを式変形すると、
𝑖
𝑎𝑖1
2
𝑖
𝑎𝑖1𝑎𝑖2
𝑖
𝑎𝑖1𝑎𝑖2
𝑖
𝑎𝑖2
2
𝑥1
𝑥2
= 𝑖
𝑎𝑖1𝑏𝑖
𝑖
𝑎𝑖2𝑏𝑖
ここで𝐴𝑇
𝐴 = 𝑖 𝑎𝑖1
2
𝑖 𝑎𝑖1𝑎𝑖2
𝑖 𝑎𝑖1𝑎𝑖2 𝑖 𝑎𝑖2
2 , 𝐴𝑇
𝑏 = 𝑖 𝑎𝑖1𝑏𝑖
𝑖 𝑎𝑖2𝑏𝑖
より、
𝐴𝑇
𝐴𝑥 = 𝐴𝑇
𝑏
よって、
𝑥 = 𝐴𝑇𝐴 −1𝐴𝑇𝑏
変数が2個の場合で説明したが、この式は変数が任意の数の場合で成り立つ。

More Related Content

Featured

Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
Christy Abraham Joy
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
Vit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
MindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools
 

Featured (20)

Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 

連立一次方程式.pptx