Y Enokida
April 09, 2020
560

# 線型計算の数理入門 / Introduction to Theoretical Numerical Linear Algebra

April 09, 2020

## Transcript

3. ### ࠓ೔͓΅͑ͯؼͬͯ΄͍͜͠ͱ ܭࢉػͰ 1 ࣍ํఔࣜΛղ͘ͷ͸·ͬͨ͘΋ͬͯ؆୯Ͱ͸ͳ͍ ࠓ೔͸ʢ΄Μͱ͏ʹʣ͍Ζ͍Ζͳ࿩Λ٧ΊࠐΉ͚ΕͲ΋ɼ͜Ε͚ͩೲಘ͍͚ͯͨͩ͠Ε͹ͦΕ Ͱॆ෼Ͱ͢ 1 ࣍ํఔࣜͷܭࢉ ݪཧతʹ͸ɼத 1

Ͱशͬͨղ͖ํͰઈରʹղ͚Δ ͜ͷ͜ͱΛཧ༝ʹʮ1 ࣍ํఔࣜ͸؆୯ʯͱ͍͏ͷ͸ૣܭ ܭࢉػ্Ͱ΍Ζ͏ͱ͢Δͱ࿩͕΍΍͘͜͠ͳΔ ʮܭࢉػʹ͸༗ݶͷढ͍͕͔͔͍ͬͯΔʯ͜ͱʹΑΔ ʮ͜Ε͚ͩ࢖͑͹͍ͭͰ΋ OK ͳສೳղ๏ʯ͸͍·ͷͱ͜Ζͳ͍ ҰํͰՊֶܭࢉʹ͓͚ΔॏཁͳҐஔΛ઎ΊΔ ʮͲΜͳܭࢉ΋ઢܕܭࢉʢ1 ࣍ํఔࣜʣʹؼண͢Δʯͱݴͬͯ΋աݴͰ͸ͳ͍ ࠓ೔Ͱ΋༷ʑͳख๏ͷ։ൃ͕ਐΊΒΕ͍ͯΔ
4. ### ઢܕܭࢉͷҰൠ࿦ʹ͍ͭͯ΋͏গ͚ͩ͠ ͖ΐ͏ѻ͏ղ๏ʢLU ෼ղʣ͸ʮফڈ๏ʯͱݺ͹ΕΔख๏ͷҰͭ ม਺Λʮফڈʯ͍ͯ͘͠ɼதֶੜͰशͬͨํ๏ʢͷԠ༻ʣ ʢ௕ॴʣޡ͕ࠩͳ͘Ұҙͳղ͕ଘࡏ͢Δঢ়گͳΒ͹ɼ༗ݶճͷܭࢉͰݫີղΛ༩͑Δ ʢ୹ॴʣߦྻͷ੒෼ n2 ݸΛ͢΂ͯϝϞϦʹ֨ೲ͢Δඞཁ͕͋Δ ޻ֶͷܭࢉͰ͸ n2

ΛϝϞϦʹ࣋ͯͳ͍΄Ͳ n ͕ڊେͳ৔߹͕͋Δ ޻ֶͷܭࢉͰ͸ཁૉͷେ൒͕ 0 ʹͳΔʢߦྻ͕ʮૄʯͰ͋Δʣ͜ͱ͕ଟ͘ɼ0 Λ֨ೲ͢ΔͨΊ͚ͩʹ ϝϞϦΛ༻ҙ͢Δͷ͸ແବ ʢ୹ॴʣ ʮঢ়گ͕ѱ͍ʯํఔࣜʹର͢ΔৼΔ෣͍͕҆ఆ͠ͳ͍ ਓؒతͳ௚ײɿ ʮํఔࣜͷ܎਺͕গ͔͠͠มΘͬͯͳ͚Ε͹ɼղ΋গ͔͠͠มΘΒͳ͍ʯ ˢશ͘΋ͬͯͦΜͳ͜ͱ͸ͳ͍ɽ͍͘ΒͰ΋൓ྫ͕ڍ͕Δʢ͋ͱͰྫΛग़͠·͢ʣ ͜ͷʮঢ়گͷѱ͞ʯ͸ʮߦྻͷ৚݅਺ʯͱ͍͏͜ͱ͹Ͱݫີʹड़΂Δ͜ͱ͕Ͱ͖Δʢ͕ɼࠓ೔͸ͦͷ ࿩͸͠ͳ͍ʣ ʮফڈ๏ʯͱ૒ᘳΛ੒͢ղ๏܈ͱͯ͠ʮ൓෮๏ʯ͕͋Δ ద౰ͳॳظ஋͔Βελʔτͯۙ͠ࣅղΛੜ੒͠ɼݫີղͱͷဃ཭Λখ͍ͯ͘͘͞͠ํ๏ ʢ௕ॴʣඇྵཁૉͷΈΛϝϞϦʹ֨ೲ͢Ε͹Α͍ ʢ௕ॴʣ൓෮ճ਺ʹԠͯ͡ղͷਫ਼౓͕޲্͢Δ ద੾ͳ৚݅ԼͰʮۙࣅղ͕ݫີղʹऩଋ͢Δ͜ͱʯ͓ΑͼʮऩଋͷεϐʔυʯΛݟੵ΋Δ͜ͱ͕Ͱ ͖Δ ʢ୹ॴʣ೉͍͠ɽઃܭΛؒҧ͑Δͱਖ਼͘͠ղ͚ͳ͍
5. ### First Example ํఔࣜ " `1 20 4 `5 # "

x1 x2 # = " `21 9 # Λղ͖͍ͨɽͪͳΈʹݫີղ͸ " 1 `1 # ɽ Α͋͘Δղ౴ A = " a b c d # ͷٯߦྻʢAB = BA = I ͱͳΔΑ͏ͳߦྻ B ͷ͜ͱɼୠ͠ I ͸୯ҐߦྻɽA`1 ͱॻ ͘ʣ͸ A`1 = 1 ad ` bc " d `b `c a # Ͱ༩͑ΒΕΔɽ1 ࣍ํఔࣜܥ Ax = b ͕༩͑ΒΕͨ࣌ɼx = A`1b Ͱ͋ΔɽͳͷͰɼٯߦ ྻΛ্ͷࣜͰܭࢉͯ͠ɼbʢ͜ͷ৔߹͸ " `21 9 # ʣʹ͔͚Ε͹Α͍ɽ
6. ### ΍ͬͯΈͨ Python Ͱ͓͕ͯΔ਺஋ܭࢉͯ͠Έͨʢఴ෇ϑΝΠϧ naive.py ࢀরʣ Motivating Example ํఔࣜ " 10

0:9999999999999999 100 10 # " x1 x2 # = " 9:0000000000000001 90 # Λղ͖͍ͨɽͪͳΈʹݫີղ͸ " 1 `1 # ɽ ΍ͬͯΈΑ͏ ͜ΜͳͷதֶੜͰ΋Ͱ͖ΔΜ͔ͩΒܭࢉػͳΒઈରͰ͖ΔΑʂ ౴͕͑ζϨͯͨΒ໦ͷԼʹຒΊͯ΋Βͬͯ΋ߏΘͳ͍Α
7. ### ݁࿦ ઌఔͷํ਑ͩͱʮ਺ֶతʹ͸ਖ਼͍͠ʯ͕ʮ޻ֶతʹ͸ޡΓʯͰ͋Δ Կ͕·͍͔ͣɿad ` bc ͰׂΓࢉ͍ͯ͠Δ෦෼͕ʮ΄΅θϩআࢉʯʹͳͬͯ͠·ͬͯ ͍Δ ܭࢉػʹ՝ͤΒΕͨʮ༗ݶͷढ͍ʯ ʢ=ුಈখ਺఺ԋࢉͷ࢓༷ʣ͕ൃಈ͢Δ 1=0:001

= 1000 ͕গ͠ζϨΔ͚ͩͰ 1=0:002 = 500 ʹͳͬͯ͠·͏ ·ͨɼม਺ͷݸ਺͕૿͑ͨ৔߹ͷ֦ுੑ΋ۃΊͯѱ͍ 2x2 ߦྻͷٯߦྻ͸؆୯͕ͩɼҰൠͷ৔߹ͷٯߦྻ͸ͱͯ΋ෳࡶ ٯߦྻΛ༩͑Δ Cramer ͷެࣜ͸ܭࢉʹ O(n!) ͔͔Δ্ʹ਺஋తʹ΋ෆ҆ఆ ํ਑ ଞͷํ਑ʹ৐Γ׵͑Δඞཁ͕͋Δɽ
8. ### ؆୯ʹղ͚Δํఔࣜʢԋश໰୊ 28.1-1ʣ ํఔࣜ 2 6 4 1 0 0 4

1 0 `6 5 1 3 7 5 2 6 4 x1 x2 x3 3 7 5 = 2 6 4 3 14 `7 3 7 5 Λલਐ୅ೖʹΑͬͯղ͚ɽ ղ౴ લਐ୅ೖͱ͍͏ݴ༿Λ஌Βͳͯ͘΋ɼͱΓ͋͑ͣ x1 = 3 ͸͙͢Θ͔Δɽ ࣍ʹ x2 = 14 ` 4x1 ΋Θ͔Δɽx1 = 3 Λ୅ೖͯ͠ x2 = 2ɽ ࣍ʹ x3 = `7 + 6x1 ` 5x2 ΋Θ͔Δɽx1 = 3; x2 = 2 Λ୅ೖͯ͠ x3 = `1ɽ લਐ୅ೖ/ޙୀ୅ೖ ܎਺ߦྻ͕ʮԼࡾ֯ʯߦྻͳΒɼx1 ; ´ ´ ´ ; xi Λʮ୅ೖͯ͠ʯxi+1 ͷ஋͕Θ͔Δɽఴ͑ ࣈ͕ʮલ޲͖ʹʯਐΜͰ͍Δɽ ܎਺ߦྻ͕ʮ্ࡾ֯ʯߦྻͳΒɼxn ; xn`1 ; ´ ´ ´ ; xn`k+1 Λʮ୅ೖͯ͠ʯxn`k ͷ஋͕ Θ͔Δɽఴ͑ࣈ͕ʮޙΖ޲͖ʹʯਐΜͰ͍Δʢޙୀ୅ೖʣ ɽ
9. ### ؾ࣋ͪ ܎਺ߦྻ͕ʮࡾ֯ʯߦྻͳΒํఔࣜΛղ͘ͷ͸ਵ෼؆୯Ͱɼ΄ͱΜͲͦͷ··ҰൠԽͰ ͖ΔΜ͚ͩͲͳ͊ʜ ඈͼಓ۩ ೚ҙͷਖ਼ଇߦྻ A ͸্ࡾ֯ߦྻ U ͱԼࡾ֯ߦྻ L

ͷੵʹ෼ղ͢ΔʢLU ෼ղʣ͜ͱ͕ ஌ΒΕ͍ͯΔɽ ʮߦྻ͕ਖ਼ଇʯʜ͜͜Ͱ͸ͱΓ͋͑ͣʮํఔ͕ࣜͨͩҰͭͷղΛ࣋ͭʯͷݴ͍׵͑ͩͱࢥͬͯ ͓͚͹ྑ͍ ͜ΕΛ࢖͑͹ Ax = b ͸ LUx = b ͱॻ͖௚ͤΔɽy = Ux ͱஔ͘ͱɼLy = bɽ Ly = b Λલਐ୅ೖͰղ͚͹ y ͕Θ͔Δɽ͋ͱ͸ Ux = y Λޙୀ୅ೖͰղ͚͹ x ͕ Θ͔Δɽ Exercise** LU ෼ղΛܭࢉ͢Δ͜ͱͱɼதֶੜͰश͏ফڈ๏͸ຊ࣭తʹಉ͡ͳͷͰ͕͢ɼͦΕΛ໌᏷ʹ ड़΂Δʹ͸͕࣌ؒ଍Γͳ͍ͷͰ֤ࣗͷԋश໰୊ͱ͠·͢ʢcf. ਿݪɾࣨాʮઢܗܭࢉͷ਺ཧʯ p.23ʣ ɽ
10. ### LU ෼ղͷྫʢԋश໰୊ 28.1-2ʣ ߦྻ 2 6 4 4 `5 6

8 `6 7 12 `7 12 3 7 5 ͷ LU ෼ղΛܭࢉͤΑɽୠ͠ɼԼࡾ֯ߦྻͷର֯੒෼͸ 1 ͱͳΔΑ͏ʹબ΂ɽ
11. ### ղ౴ 2 6 4 4 `5 6 8 `6 7

12 `7 12 3 7 5 = 2 6 4 1 0 0 l21 1 0 l31 l32 1 3 7 5 2 6 4 u11 u12 u13 0 u22 u23 0 0 u33 3 7 5 Λ࣮ࡍʹ੒෼͝ͱʹղ͍ͯΈΕ͹ྑ͍ɽ͜Ε͸࣮ࡍʹखΛಈ͔͢ͱͳΜͱͳ͘Θ͔Δʢ͠ɼ खΛಈ͔͞ͳ͍ͱͨͿΜ͋Μ·ΓΘ͔Βͳ͍ʣͷͰɼࢼ͠ʹܭࢉΛ֤ࣗͰ΍ͬͯΈΔ͜ͱΛ ڧ͓͘͢͢Ί͠·͢ɽҎԼΛॱ൪ʹߟ͍͚͑ͯ͹Α͍Ͱ͢ʀ L ͷୈ 1 ߦͱ U ͷୈ 1,2,3 ྻͷֻ͚ࢉ L ͷୈ 2 ߦͱ U ͷୈ 1,2,3 ྻͷֻ͚ࢉ L ͷୈ 3 ߦͱ U ͷୈ 1,2,3 ྻͷֻ͚ࢉ 2 6 4 4 `5 6 8 `6 7 12 `7 12 3 7 5 = 2 6 4 1 0 0 2 1 0 3 2 1 3 7 5 2 6 4 4 `5 6 0 4 `5 0 0 4 3 7 5 LU ෼ղͷΞϧΰϦζϜͱ࣌ؒܭࢉྔ ͜ͷܭࢉΛʢϕλॻ͖ͤͣʹʣfor จΛ࢖ͬͨܗʹ௚ͤ͹ͦͷ··ΞϧΰϦζϜͱͯ͠ػೳ ͢Δɽܭࢉ͢Δม਺͕ n2 ݸ͋Γɼ֤ม਺͝ͱͷฏۉ࣌ؒܭࢉྔ͕ ˆ(n) ͱͳΔͷͰɼશମ ͷฏۉ࣌ؒܭࢉྔ͸ ˆ(n3)ɽ
12. ### ؼೲతͳ LU ෼ղͷߏ੒ ڭՊॻͰ͸ؼೲతʹ LU ෼ղΛߏ੒͍ͯ͠Δɽ A = " a11

w> v A0 # = " 1 0 v=a11 I # " a11 w> 0 A0 ` vw>=a11 # ͳΔ෼ղΛར༻͢Ε͹ؼೲతʹ΋Ͱ͖Δʢ͕ɼLU ෼ղ͕ଘࡏ͢Δߦྻʹରͯ͠෼ղΛٻΊ ΒΕͳ͍ϦεΫ͕͋ΔɽͦΕΏ͑ݸਓతʹ͸޷͖Ͱ͸ͳ͍ɽൃදͰ΋ѻΘͳ͍ʣ ɽ͜͜Ͱ࣍Λ ར༻͍ͯ͠Δʀ ϒϩοΫߦྻʹର͢Δܭࢉ 2 ͭͷਖ਼ํߦྻ X; Y Λɼ X = " A B C D # ; Y = " E F G H # ͱϒϩοΫʹ෼ׂ͢Δ͜ͱΛߟ͑Δɽୠ͠ɼA ͱ E ͷαΠζ͕ಉ͡ʹͳΔΑ͏ʹ͢Δɽ͜ ͷͱ͖ɼX ͱ Y ͷੵ͸ʮ2 ߦ 2 ྻͷߦྻΛܭࢉ͢Δͷͱಉ༷ʹʯܭࢉ͢Δ͜ͱ͕Ͱ͖Δɽ ΑΓਖ਼֬ʹड़΂Ε͹ɼ͕࣍੒Γཱͭʀ XY = " AE + BG AF + BH CE + DG CF + DH #
13. ### ํఔ͕ࣜղΛ͕࣋ͭ LU ෼ղ͕ػೳ͠ͳ͍ྫʢԋश໰୊ 28.1-3 վʣ 2 6 4 0 2

3 5 1 4 8 5 2 3 7 5 2 6 4 x1 x2 x3 3 7 5 = 2 6 4 9 12 5 3 7 5 Λղ͚ɽ όά ͜ͷ܎਺ߦྻͷ LU ෼ղ͸ଘࡏ͠ͳ͍ʢଘࡏ͢ΔͱԾఆͨ͠Βໃ६͕ग़Δʣ ɽ ͷ͕ͩɼ͜ͷํఔࣜ͸།Ұͭͷղ 2 6 4 `1=19 `3=19 59=19 3 7 5 Λ࣋ͭɽ Կ͕໰୊ͳͷ͔ʁ ର֯੒෼ͷ 0ʢಛʹ (1,1) ੒෼ʹ 0 ͕͍Δ͍ͤͰ LU ෼ղ͕ଘࡏ͠ͳ͍ʣ ʮର֯੒෼ͰׂΔૢ࡞ʯ͸ඞਢɽͦͷ͜ͱ͔Β΋ɼ0 ͸໪࿦ɼ0 ʹ͍ۙ਺΋׻ܴͰ͖ͳ͍ ʮ਻࣠બ୒ʯ ʢpivotingʣΛ͢Δඞཁ͕͋Δ
14. ### ਻࣠બ୒ ͻΒ͍ͨ͑͘͹ʮର֯੒෼ΛͳΔ͚ͩେ͖͘ͳΔΑ͏ʹߦͷೖΕସ͑Λ͢Δʯ͜ͱɽ 2 6 4 0 2 3 5 1

4 8 5 2 3 7 5 2 6 4 x1 x2 x3 3 7 5 = 2 6 4 9 12 5 3 7 5 ্ͷࣜͰ (1,1) ੒෼͕େ͖͘ͳΔΑ͏ʹߦͷೖΕସ͑Λ͍ͨ͠ɽݟͨͱ͜Ζ 3 ߦ໨ͱೖΕ ସ͑Δͱྑͦ͞͏ɽ 2 6 4 8 5 2 5 1 4 0 2 3 3 7 5 2 6 4 x1 x2 x3 3 7 5 = 2 6 4 5 12 9 3 7 5 ࣍ʹ (2,2) ੒෼͕େ͖͘ͳΔΑ͏ʹߦͷೖΕସ͑Λ͍ͨ͠ɽݟͨͱ͜Ζ 1 ߦ໨ͱೖΕସ͑ ͨ͘ͳΔ͕ɼͦΕΛ΍Δͱ͏·͘ಈ͔ͳ͍͜ͱ͕͋Δʢ௚ײɿྫ͑͹ॱ܁ΓʹೖΕସ͑ͯ ͍ͬͯɼ݁ہԿ΋͠ͳ͔ͬͨ৔߹ͱҰॹʹͳΓ͑ΔʣͷͰɼࣗ෼ʢ2 ߦ໨ʣҎ߱ͷߦͱݟൺ΂ Δɽ3 ߦ໨ͱೖΕସ͑Δͱྑͦ͞͏ɽ 2 6 4 8 5 2 0 2 3 5 1 4 3 7 5 2 6 4 x1 x2 x3 3 7 5 = 2 6 4 5 9 12 3 7 5
15. ### ਻࣠બ୒ͨ͠ߦྻʹର͢Δ LU ෼ղ ͔ͯ࣍͘͠ͷํఔ͕ࣜಘΒΕͨʀ 2 6 4 8 5 2

0 2 3 5 1 4 3 7 5 2 6 4 x1 x2 x3 3 7 5 = 2 6 4 5 9 12 3 7 5 ͜ͷ܎਺ߦྻ͸ LU ෼ղ͢Δ͜ͱ͕Ͱ͖Δʀ 2 6 4 8 5 2 0 2 3 5 1 4 3 7 5 = 2 6 4 1 0 0 0 1 0 5=8 `17=16 1 3 7 5 2 6 4 8 5 2 0 2 3 0 0 95=16 3 7 5 ͖ΐ͏ͷ࿩Ͱ͸লུ͢Δ͜ͱ ͍·ͷʮม਺ͷೖΕସ͑ʯ͸ɼߦྻͷ͜ͱ͹Ͱॻ͚Δ ڵຯ͕͋Ε͹ʮஔ׵ߦྻʯͰௐ΂͍ͯͩ͘͞ LU ෼ղ͸ଘࡏ͢Δͱ͸ݶΒͳ͍͕ɼߦΛద੾ʹೖΕସ͑Ε͹ LU ෼ղ͕Ͱ͖Δ͜ͱΛݟ ͨɽ͜ͷʮߦΛద੾ʹೖΕସ͑ͨ LU ෼ղʯͷ͜ͱΛ LUP ෼ղͱݺͿɽ LU(P ) ෼ղͷଘࡏ͢Δ৚݅ͱͦͷৄࡉʹ͍ͭͯ ݁࿦͚ͩड़΂Δͱɼ ʮ೚ҙͷਖ਼ํߦྻʹରͯ͠ LUP ෼ղ͸ଘࡏ͢Δʯ ɽ ʮਖ਼ଇߦྻʹର͠ɼͦ ͷ LU ෼ղ͕ଘࡏ͢Δ͜ͱͱɼͦͷ͢΂ͯͷट࠲খߦྻ͕ࣜඇྵͰ͋Δ͜ͱ͸ಉ஋ʯ ɽ