Linear Algebra rimer And a video dicuion of linear algebra from EE263 i here (lecure 3 and 4): hp://ee.anford.edu/coure/ee263 lide from Sanford CS3
Ouline Vecor and marice Baic Mari Operaion Deerminan, norm, race Special Marice Tranformaion Marice Homogeneou coordinae Tranlaion Mari invere Mari rank Eigenvalue and Eigenvecor Mari Calculu 2
Ouline Vecor and marice Baic Mari Operaion Deerminan, norm, race Special Marice Tranformaion Marice Homogeneou coordinae Tranlaion Mari invere Mari rank Eigenvalue and Eigenvecor Mari Calculu Vecor and marice are ju collecion of ordered number ha repreen omehing: movemen in pace, caling facor, piel brighne, ec. We ll define ome common ue and andard operaion on hem. 3
Vecor A column vecor where A row vecor where denoe he ranpoe operaion 4
Vecor We ll defaul o column vecor in hi cla You ll wan o keep rack of he orienaion of our vecor when programming in phon You can ranpoe a vecor V in malab b wriing V (Bu in cla maerial, we will alwa ue V T o indicae ranpoe, and we will ue V o mean V prime ) 5
Vecor have wo main ue Vecor can repreen an offe in 2D or 3D pace oin are ju vecor from he origin Daa (piel, gradien a an image kepoin, ec) can alo be reaed a a vecor Such vecor don have a geomeric inerpreaion, bu calculaion like diance can ill have value 6
Mari A mari i an arra of number wih ize b, i.e. m row and n column. If, we a ha i quare. 7
Image MATLAB repreen an image a a mari of piel brighnee Noe ha he upper lef corner i (,) (,) 8
Color Image Gracale image have one number per piel, and are ored a an m n mari. Color image have 3 number per piel red, green, and blue brighnee (RGB) Sored a an m n 3 mari 9
Baic Mari Operaion We will dicu: Addiion Scaling Do produc Muliplicaion Tranpoe Invere / peudoinvere Deerminan / race
Mari Operaion Addiion Can onl add a mari wih maching dimenion, or a calar. Scaling
Vecor Norm More formall, a norm i an funcion ha aifie 4 properie: Non-negaivi: For all Definiene: f() if and onl if. Homogenei: For all Triangle inequali: For all 2
Mari Operaion Eample Norm General norm: 3
Mari Operaion Inner produc (do produc) of vecor Mulipl correponding enrie of wo vecor and add up he reul i alo Co( he angle beween and ) 4
Mari Operaion Inner produc (do produc) of vecor If B i a uni vecor, hen A B give he lengh of A which lie in he direcion of B 5
Mari Operaion The produc of wo marice 6
Muliplicaion Mari Operaion The produc AB i: Each enr in he reul i (ha row of A) do produc wih (ha column of B) Man ue, which will be covered laer 7
Mari Operaion Muliplicaion eample: Each enr of he mari produc i made b aking he do produc of he correponding row in he lef mari, wih he correponding column in he righ one. 8
Mari Operaion The produc of wo marice 9
Mari Operaion ower B convenion, we can refer o he mari produc AA a A 2, and AAA a A 3, ec. Obvioul onl quare marice can be muliplied ha wa 2
Mari Operaion Tranpoe flip mari, o row become column A ueful ideni: 2
Deerminan reurn a calar Repreen area (or volume) of he parallelogram decribed b he vecor in he row of he mari For, roperie: Mari Operaion de % de de(%) 22
Mari Operaion Trace Invarian o a lo of ranformaion, o i ued omeime in proof. (Rarel in hi cla hough.) roperie: 23
Mari Operaion Vecor Norm Mari norm: Norm can alo be defined for marice, uch a he Frobeniu norm: 24
Special Marice Ideni mari I Square mari, along diagonal, elewhere I [anoher mari] [ha mari] Diagonal mari Square mari wih number along diagonal, elewhere A diagonal [anoher mari] cale he row of ha mari 25
Special Marice Smmeric mari Skew-mmeric mari 2 2 3 5 42 75 5 7 26
Ouline Vecor and marice Baic Mari Operaion Deerminan, norm, race Special Marice Tranformaion Marice Homogeneou coordinae Tranlaion Mari invere Mari rank Eigenvalue and Eigenvecor Mari Calculu Mari muliplicaion can be ued o ranform vecor. A mari ued in hi wa i called a ranformaion mari. 27
Tranformaion Marice can be ued o ranform vecor in ueful wa, hrough muliplicaion: A Simple i caling: (Verif o ourelf ha he mari muliplicaion work ou hi wa) 28
Roaion How can ou conver a vecor repreened in frame o a new, roaed coordinae frame? 29
Roaion How can ou conver a vecor repreened in frame o a new, roaed coordinae frame? Remember wha a vecor i: [componen in direcion of he frame ai, componen in direcion of ai] 3
Roaion So o roae i we mu produce hi vecor: [componen in direcion of new ai, componen in direcion of new ai] We can do hi eail wih do produc! New coordinae i [original vecor] do [he new ai] New coordinae i [original vecor] do [he new ai] 3
Roaion Inigh: hi i wha happen in a mari*vecor muliplicaion Reul coordinae i: [original vecor] do [mari row ] So mari muliplicaion can roae a vecor p: 32
Roaion Suppoe we epre a poin in he new coordinae em which i roaed lef If we plo he reul in he original coordinae em, we have roaed he poin righ Thu, roaion marice can be ued o roae vecor. We ll uuall hink of hem in ha ene-- a operaor o roae vecor 33
2D Roaion Mari Formula Couner-clockwie roaion b an angle q q coθ -in θ coθ + in θ coq - in q in q coq R 34
Tranformaion Marice Muliple ranformaion marice can be ued o ranform a poin: p R 2 R S p 35
Tranformaion Marice Muliple ranformaion marice can be ued o ranform a poin: p R 2 R S p The effec of hi i o appl heir ranformaion one afer he oher, from righ o lef. In he eample above, he reul i (R 2 (R (S p))) 36
Tranformaion Marice Muliple ranformaion marice can be ued o ranform a poin: p R 2 R S p The effec of hi i o appl heir ranformaion one afer he oher, from righ o lef. In he eample above, he reul i (R 2 (R (S p))) The reul i eacl he ame if we mulipl he marice fir, o form a ingle ranformaion mari: p (R 2 R S) p 37
Homogeneou em In general, a mari muliplicaion le u linearl combine componen of a vecor Thi i ufficien for cale, roae, kew ranformaion. Bu noice, we can add a conan! L 38
Homogeneou em The (omewha hack) oluion? Sick a a he end of ever vecor: Now we can roae, cale, and kew like before, AND ranlae (noe how he muliplicaion work ou, above) Thi i called homogeneou coordinae 39
Homogeneou em In homogeneou coordinae, he muliplicaion work ou o he righmo column of he mari i a vecor ha ge added. Generall, a homogeneou ranformaion mari will have a boom row of [ ], o ha he reul ha a a he boom oo. 4
Homogeneou em One more hing we migh wan: o divide he reul b omehing Mari muliplicaion can acuall divide So, b convenion, in homogeneou coordinae, we ll divide he reul b i la coordinae afer doing a mari muliplicaion 4 /2/7
2D Tranlaion 42
43 2D Tranlaion uing Homogeneou Coordinae + +,), ( ), (,), ( ), (
44 2D Tranlaion uing Homogeneou Coordinae + +,), ( ), (,), ( ), (
45 2D Tranlaion uing Homogeneou Coordinae + +,), ( ), (,), ( ), (
46 2D Tranlaion uing Homogeneou Coordinae + +,), ( ), (,), ( ), (
47 2D Tranlaion uing Homogeneou Coordinae + +,), ( ), (,), ( ), ( T I
Scaling 48
Scaling Equaion (, ) (, ) (, ) (,,) (, ) (,,) 49
Scaling Equaion,), ( ), (,), ( ), ( ), ( ), ( 5
Scaling Equaion,), ( ), (,), ( ), ( S S S ), ( ), ( 5
Scaling & Tranlaing S T T T (S ) T S 52
Scaling & Tranlaing T S " # % & " # % & " # % & " # % & " # % & + + " # % & S " # % & " # % & A 53
Scaling & Tranlaing T S " # % & " # % & " # % & " # % & " # % & + + " # % & S " # % & " # % & 54
Tranlaing & Scaling veru Scaling & Tranlaing + + S T 55
Tranlaing & Scaling! Scaling & Tranlaing + + T S + + S T 56
Tranlaing & Scaling! Scaling & Tranlaing + + T S + + S T 57
Roaion 58
Roaion Equaion Couner-clockwie roaion b an angle q q coθ -in θ coθ + in θ coq - in q in q coq R 59
Roaion Mari roperie coq - in q in q coq A 2D roaion mari i 22 Noe: R belong o he caegor of normal marice and aifie man inereing properie: R R T R T R I de( R) 6
Roaion Mari roperie Tranpoe of a roaion mari produce a roaion in he oppoie direcion R R T de( R) R The row of a roaion mari are alwa muuall perpendicular (a.k.a. orhogonal) uni vecor (and o are i column) R T I 6
Scaling + Roaion + Tranlaion (T R S) - coθ inθ in θ coθ R S T - coθ inθ in θ coθ R S S R 62 Thi i he form of he general-purpoe ranformaion mari
Announcemen HW will be releaed hi Frida nigh 63
Ouline Vecor and marice Baic Mari Operaion Deerminan, norm, race Special Marice Tranformaion Marice Homogeneou coordinae Tranlaion Mari invere Mari rank Eigenvalue and Eigenvecor Mari Calculae The invere of a ranformaion mari revere i effec 64
Given a mari A, i invere A - i a mari uch ha AA - A - A I E.g. Invere Invere doe no alwa ei. If A - ei, A i inverible or non-ingular. Oherwie, i ingular. Ueful ideniie, for marice ha are inverible: 65
Ouline Vecor and marice Baic Mari Operaion Deerminan, norm, race Special Marice Tranformaion Marice Homogeneou coordinae Tranlaion Mari invere Mari rank Eigenvalue and Eigenvecor Mari Calculae The rank of a ranformaion mari ell ou how man dimenion i ranform a vecor o. 7
Linear independence Suppoe we have a e of vecor v,, v n If we can epre v a a linear combinaion of he oher vecor v 2 v n, hen v i linearl dependen on he oher vecor. The direcion v can be epreed a a combinaion of he direcion v 2 v n. (E.g. v.7 v 2 -.7 v 4 ) 72
Linear independence Suppoe we have a e of vecor v,, v n If we can epre v a a linear combinaion of he oher vecor v 2 v n, hen v i linearl dependen on he oher vecor. The direcion v can be epreed a a combinaion of he direcion v 2 v n. (E.g. v.7 v 2 -.7 v 4 ) If no vecor i linearl dependen on he re of he e, he e i linearl independen. Common cae: a e of vecor v,, v n i alwa linearl independen if each vecor i perpendicular o ever oher vecor (and non-zero) 73
Linear independence Linearl independen e No linearl independen 74
Mari rank Column/row rank Column rank alwa equal row rank Mari rank 75
Mari rank For ranformaion marice, he rank ell ou he dimenion of he oupu E.g. if rank of A i, hen he ranformaion p Ap map poin ono a line. Here a mari wih rank : All poin ge mapped o he line 2 76
Mari rank If an m m mari i rank m, we a i full rank Map an m vecor uniquel o anoher m vecor An invere mari can be found If rank < m, we a i ingular A lea one dimenion i geing collaped. No wa o look a he reul and ell wha he inpu wa Invere doe no ei Invere alo doen ei for non-quare marice 77