summaryrefslogtreecommitdiff
path: root/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file2_Row_Space.py
blob: b16a32afbbba0cd07a8a67f318bce2f7d771e26b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
from manimlib.imports import *

class Row_Space(Scene):
    def construct(self):

        Heading = TextMobject("Row Space")
        defn1 = TextMobject("Definition 1: Row Space of a matrix is the linear combination of the rows of that matrix.")
        defn2 = TextMobject("Definition 2: It is a vector space generated by a linear combination of the columns of $A^{T}$.")
        equivalent = TextMobject(r"Definition 1 $\equiv$ Definition 2")

        Heading.move_to(2*UP)
        Heading.set_color(color = DARK_BLUE)

        defn1.move_to(UP)
        defn1.scale(0.75)

        defn2.scale(0.75)

        equivalent.move_to(DOWN)

        self.play(Write(Heading))
        self.play(Write(defn1))
        self.play(Write(defn2))
        self.play(Write(equivalent))

        self.wait(2)
        self.play(FadeOut(Heading),FadeOut(defn1),FadeOut(defn2),ApplyMethod(equivalent.move_to,2*UP))

        how = TextMobject("Let us see, How?")
        how.move_to(UP)
        self.play(Write(how))
        self.play(FadeOut(equivalent),FadeOut(how))

        A = TextMobject(r"$A = $",r"$\left( \begin{array}{c c c} 1 & 2 & 1 \\ 1 & 3 & 1 \\ 2 & 1 & 4 \\ 3 & 2 & 3 \end{array} \right)$")
        A.move_to(2*UP+3*LEFT)
        A[1].set_color(color = DARK_BLUE)
        A.scale(0.80)

        self.play(Write(A))

        rows = TextMobject(r"Rows of A $\rightarrow$",
        r"$\left( \begin{array}{c c c} 1 & 2 & 1 \end{array} \right)$,",
        r"$ \left( \begin{array}{c c c} 1 & 3 & 1 \end{array} \right)$,",
        r"$\left( \begin{array}{c c c} 2 & 1 & 4 \end{array} \right)$,",
        r"$ \left( \begin{array}{c c c} 3 & 2 & 3 \end{array} \right)$")
        rows.scale(0.75)
        rows[1:5].set_color(DARK_BLUE)
        self.play(Write(rows))

        ac_defn1 = TextMobject("According to Definition 1 : ")
        ac_defn1.move_to(DOWN)

        RS_A = TextMobject(r"Row Space of $A = x_{1}$",
        r"$\left( \begin{array}{c c c} 1 & 2 & 1 \end{array} \right)$",
        r"$+x_{2}$",
        r"$ \left( \begin{array}{c c c} 1 & 3 & 1 \end{array} \right)$",
        r"$ + x_{3}$",
        r"$\left( \begin{array}{c c c} 2 & 1 & 4 \end{array} \right)$",
        r"$+x_{4}$",
        r"$ \left( \begin{array}{c c c} 3 & 2 & 3 \end{array} \right)$")
        RS_A.move_to(DOWN+DOWN)
        RS_A[6].move_to(2*DOWN+DOWN)
        RS_A[7].move_to(2*DOWN+2*RIGHT+DOWN)
        RS_A[1].set_color(color = DARK_BLUE)
        RS_A[3].set_color(color = DARK_BLUE)
        RS_A[5].set_color(color = DARK_BLUE)
        RS_A[7].set_color(color = DARK_BLUE)
        RS_A.scale(0.75)

        self.play(FadeOut(rows[0]),Transform(rows[1],RS_A[1]),Transform(rows[2],RS_A[3]),Transform(rows[3],RS_A[5]),Transform(rows[4],RS_A[7]))
        self.play(FadeIn(ac_defn1), Write(RS_A))
        self.wait(1)

        self.play(FadeOut(rows[1]), FadeOut(rows[2]), FadeOut(rows[3]), FadeOut(rows[4]), FadeOut(RS_A), FadeOut(ac_defn1))

        A_T = TextMobject(r"$A^{T} = $",r"$\left( \begin{array}{c c c c} 1 & 1 & 2 & 3 \\ 2 & 3 & 1 & 2 \\ 1 & 1 & 4 & 3 \end{array} \right)$")
        A_T.move_to(2*UP+3*RIGHT)
        A_T[1].set_color(color = DARK_BLUE)
        A_T.scale(0.80)

        self.play(Write(A_T))

        change1 = TextMobject(r"Rows of $A\equiv$ Columns of $A^{T}$")
        change2 = TextMobject(r"Columns of $A\equiv$ Rows of $A^{T}$")
        change2.move_to(DOWN)

        change3 = TextMobject(r"Row Space of $A$ = Linear Combination of",r"Rows","of",r"A")
        change3.move_to(2*DOWN)
        change3[1].set_color(DARK_BLUE)
        change3[3].set_color(DARK_BLUE)

        self.play(Write(change1))
        self.play(Write(change2))
        self.play(Write(change3))

        columns = TextMobject("Columns")
        columns.scale(0.6)
        columns.set_color(DARK_BLUE)
        columns.move_to(2*DOWN+4.1*RIGHT)

        a = TextMobject(r"$A^{T}$")
        a.set_color(DARK_BLUE)
        a.move_to(1.95*DOWN+5.6*RIGHT)

        self.wait(0.5)

        self.play(Transform(change3[1],columns), Transform(change3[3],a))

        equal = TextMobject(r"= Column Space($A^{T}$)")
        equal.move_to(3*DOWN+0.5*RIGHT)

        self.play(Write(equal))

        self.play(FadeOut(A_T), FadeOut(change1), FadeOut(change2), FadeOut(change3), FadeOut(A), FadeOut(equal))

        ac_defn1.move_to(3*UP)
        RS_A.move_to(1.5*UP)
        RS_A[6].move_to(UP)
        RS_A[7].move_to(UP+1.5*RIGHT)
        
        self.play(Write(RS_A),FadeIn(ac_defn1))
        
        CS_AT = TextMobject(r"Row Space of $A = x_{1}$",
        r"$\left( \begin{array}{c} 1 \\ 2 \\ 1 \end{array} \right)$",
        r"$+x_{2}$",
        r"$ \left( \begin{array}{c} 1 \\ 3 \\ 1 \end{array} \right)$",
        r"$ + x_{3}$",
        r"$\left( \begin{array}{c} 2 \\ 1 \\ 4 \end{array} \right)$",
        r"$+x_{4}$",
        r"$ \left( \begin{array}{c} 3 \\ 2 \\ 3 \end{array} \right)$")
        CS_AT.move_to(1.5*DOWN)
        CS_AT[1].set_color(color = DARK_BLUE)
        CS_AT[3].set_color(color = DARK_BLUE)
        CS_AT[5].set_color(color = DARK_BLUE)
        CS_AT[7].set_color(color = DARK_BLUE)
        CS_AT.scale(0.75)
        
        ac_defn2 = TextMobject("According to Definition 2 : ")
        equivalent = TextMobject(r"Hence, Definition 1 $\equiv$ Definition 2")
        equivalent.move_to(3*DOWN)

        self.play(Write(CS_AT),FadeIn(ac_defn2))
        self.play(Write(equivalent))

        self.wait()