SlideShare a Scribd company logo
Linear Algebra and Matrices
Methods for Dummies
21st October, 2009
Elvina Chu & Flavia Mancini
Talk Outline
• Scalars, vectors and matrices
• Vector and matrix calculations
• Identity, inverse matrices & determinants
• Solving simultaneous equations
• Relevance to SPM
Linear Algebra & Matrices, MfD 2009
Scalar
• Variable described by a single number
e.g. Intensity of each voxel in an MRI scan
Linear Algebra & Matrices, MfD 2009
Vector
• Not a physics vector (magnitude, direction)
• Column of numbers e.g. intensity of same voxel at
different time points
Linear Algebra & Matrices, MfD 2009










3
2
1
x
x
x
Matrices
• Rectangular display of vectors in rows and columns
• Can inform about the same vector intensity at different
times or different voxels at the same time
• Vector is just a n x 1 matrix











4
7
6
1
4
5
3
2
1
A
Square (3 x 3) Rectangular (3 x 2) d i j : ith row, jth column
Defined as rows x columns (R x C)











8
3
7
2
4
1
C











33
32
31
23
22
21
13
12
11
d
d
d
d
d
d
d
d
d
D
Linear Algebra & Matrices, MfD 2009
Matrices in Matlab
• X=matrix
• ;=end of a row
• :=all row or column










9
8
7
6
5
4
3
2
1
Subscripting – each element of a matrix
can be addressed with a pair of numbers;
row first, column second (Roman Catholic)
e.g. X(2,3) = 6
X(3, :) =
X( [2 3], 2) =
 
9
8
7








8
5
“Special” matrix commands:
• zeros(3,1) =
• ones(2) =
• magic(3) =








1
1
1
1










0
0
0
Linear Algebra & Matrices, MfD 2009










2
9
4
7
5
3
6
1
8
Design matrix
=
a
m
b3
b4
b5
b6
b7
b8
b9
+
e
= b +
Y X ´
Linear Algebra & Matrices, MfD 2009
Transposition











2
1
1
b  
2
1
1

T
b  
9
4
3

d
column row row column











4
7
6
1
4
5
3
2
1
A











4
1
3
7
4
2
6
5
1
T
A
Linear Algebra & Matrices, MfD 2009











9
4
3
T
d
Matrix Calculations
Addition
– Commutative: A+B=B+A
– Associative: (A+B)+C=A+(B+C)
Subtraction
- By adding a negative matrix
































6
5
4
3
1
5
3
2
0
4
1
2
1
3
0
1
5
2
4
2
B
A
Linear Algebra & Matrices, MfD 2009
Scalar multiplication
• Scalar x matrix = scalar multiplication
Linear Algebra & Matrices, MfD 2009
Matrix Multiplication
“When A is a mxn matrix & B is a kxl matrix,
AB is only possible if n=k. The result will be
an mxl matrix”
A1 A2 A3
A4 A5 A6
A7 A8 A9
A10 A11 A12
m
n
x
B13 B14
B15 B16
B17 B18
l
k
Number of columns in A = Number of rows in B
= m x l matrix
Linear Algebra & Matrices, MfD 2009
Matrix multiplication
• Multiplication method:
Sum over product of respective rows and columns

1 0
2 3





 







1
3
1
2








22
21
12
11
c
c
c
c


















1)
(3
1)
(2
3)
(3
2)
(2
1)
(0
1)
(1
3)
(0
2)
(1








5
13
1
2
X =
=
=
Define output
matrix
A B
• Matlab does all this for you!
• Simply type: C = A * B
Linear Algebra & Matrices, MfD 2009
Matrix multiplication
• Matrix multiplication is NOT commutative
• AB≠BA
• Matrix multiplication IS associative
• A(BC)=(AB)C
• Matrix multiplication IS distributive
• A(B+C)=AB+AC
• (A+B)C=AC+BC
Linear Algebra & Matrices, MfD 2009
Vector Products
Inner product XTY is a scalar
(1xn) (nx1)
Outer product XYT is a matrix
(nx1) (1xn)
xyT

x1
x2
x3










y1 y2 y3
 
x1y1 x1y2 x1y3
x2y1 x2y2 x2y3
x3y1 x3y2 x3y3










  i
i
i
T
y
x
y
x
y
x
y
x
y
y
y
x
x
x 
















3
1
3
3
2
2
1
1
3
2
1
3
2
1
y
x
Inner product = scalar
Two vectors:











3
2
1
x
x
x
x











3
2
1
y
y
y
y
Outer product = matrix
Linear Algebra & Matrices, MfD 2009
Identity matrix
Is there a matrix which plays a similar role as the number 1 in number
multiplication?
Consider the nxn matrix:
For any nxn matrix A, we have A In = In A = A
For any nxm matrix A, we have In A = A, and A Im = A (so 2 possible matrices)
Linear Algebra & Matrices, MfD 2009
Identity matrix
1 2 3 1 0 0 1+0+0 0+2+0 0+0+3
4 5 6 X 0 1 0 = 4+0+0 0+5+0 0+0+6
7 8 9 0 0 1 7+0+0 0+8+0 0+0+9
Worked example
A I3 = A
for a 3x3 matrix:
• In Matlab: eye(r, c) produces an r x c identity matrix
Linear Algebra & Matrices, MfD 2009
Matrix inverse
• Definition. A matrix A is called nonsingular or invertible if there
exists a matrix B such that:
• Notation. A common notation for the
inverse of a matrix A is A-1. So:
• The inverse matrix is unique when it exists. So if A is invertible, then A-1
is also invertible and then (AT)-1 = (A-1)T
1 1 X
2
3
-1
3
=
2 + 1
3 3
-1 + 1
3 3
= 1 0
-1 2
1
3
1
3
-2+ 2
3 3
1 + 2
3 3
0 1
• In Matlab: A-1 = inv(A) •Matrix division: A/B= A*B-1
Linear Algebra & Matrices, MfD 2009
Matrix inverse
• For a XxX square matrix:
• The inverse matrix is:
Linear Algebra & Matrices, MfD 2009
• E.g.: 2x2 matrix
Determinants
• Determinants are mathematical objects that are very useful in the
analysis and solution of systems of linear equations (i.e. GLMs).
• The determinant is a function that associates a scalar det(A) to every
square matrix A.
– Input is nxn matrix
– Output is a single
number (real or
complex) called the
determinant
Linear Algebra & Matrices, MfD 2009
Determinants
•Determinants can only be found for square matrices.
•For a 2x2 matrix A, det(A) = ad-bc. Lets have at closer look at that:
• A matrix A has an inverse matrix A-1 if and only if det(A)≠0.
• In Matlab: det(A) = det(A)
Linear Algebra & Matrices, MfD 2009
a b
c d
det(A) = = ad - bc
[ ]
Solving simultaneous equations
For one linear equation ax=b where the unknown is x and a
and b are constants,
3 possibilities:
If 0

a then b
a
a
b
x 1


 thus there is single solution
If 0

a , 0

b then the equation b
ax  becomes 0
0 
and any value of x will do
If 0

a , 0

b then b
ax  becomes b

0 which is a
contradiction
Linear Algebra & Matrices, MfD 2009
With >1 equation and >1 unknown
• Can use solution from the single
equation to solve
• For example
• In matrix form
b
a
x 1


1
2
5
3
2
2
1
2
1





x
x
x
x
A X = B




















 1
5
2
1
3
2
2
1
x
x
X =A-1B
Linear Algebra & Matrices, MfD 2009






4
1
• X =A-1B
• To find A-1
• Need to find determinant of matrix A
• From earlier
(2 -2) – (3 1) = -4 – 3 = -7
• So determinant is -7
bc
ad
d
c
b
a
A 


)
det(






 2
1
3
2
Linear Algebra & Matrices, MfD 2009

A1

1
det(A)
d b
c a


























2
1
3
2
7
1
2
1
3
2
)
7
(
1
1
A
1
2
7
14
7
1
4
1
2
1
3
2
7
1
























X






4
1
if B is
So
b
a
x 1


Linear Algebra & Matrices, MfD 2009
Linear Algebra & Matrices, MfD 2009
How are matrices relevant
to fMRI data?
Normalisation
Statistical Parametric Map
Image time-series
Parameter estimates
General Linear Model
Realignment Smoothing
Design matrix
Anatomical
reference
Spatial filter
Statistical
Inference
RFT
p <0.05
Linear Algebra & Matrices, MfD 2009
Linear Algebra & Matrices, MfD 2009
BOLD signal
Time
single voxel
time series
Voxel-wise time series analysis
Model
specification
Parameter
estimation
Hypothesis
Statistic
SPM
How are matrices relevant to fMRI data?
=
a
m
b3
b4
b5
b6
b7
b8
b9
+
e
= b +
Y X ´
Linear Algebra & Matrices, MfD 2009
GLM equation
N
of
scans
How are matrices relevant to fMRI data?
Y
Response variable
e.g BOLD signal at a particular
voxel
A single voxel sampled at successive
time points.
Each voxel is considered as
independent observation.
Preprocessing
...
Intens
ity
Ti
me
Y
Time
Y = X . β + ε
Linear Algebra & Matrices, MfD 2009
How are matrices relevant to fMRI data?
a
m
b3
b4
b5
b6
b7
b8
b9
b
X ´
Explanatory variables
– These are assumed to be
measured without error.
– May be continuous;
– May be dummy,
indicating levels of an
experimental factor.
Y = X . β + ε
Solve equation for β – tells us
how much of the BOLD signal is
explained by X
Linear Algebra & Matrices, MfD 2009
In Practice
• Estimate MAGNITUDE of signal changes
• MR INTENSITY levels for each voxel at
various time points
• Relationship between experiment and
voxel changes are established
• Calculation and notation require linear
algebra
Linear Algebra & Matrices, MfD 2009
Summary
• SPM builds up data as a matrix.
• Manipulation of matrices enables unknown
values to be calculated.
Y = X . β + ε
Observed = Predictors * Parameters + Error
BOLD = Design Matrix * Betas + Error
Linear Algebra & Matrices, MfD 2009
References
• SPM course http://www.fil.ion.ucl.ac.uk/spm/course/
• Web Guides
http://mathworld.wolfram.com/LinearAlgebra.html
http://www.maths.surrey.ac.uk/explore/emmaspages/option1.ht
ml
http://www.inf.ed.ac.uk/teaching/courses/fmcs1/
(Formal Modelling in Cognitive Science course)
• http://www.wikipedia.org
• Previous MfD slides
Linear Algebra & Matrices, MfD 2009

More Related Content

What's hot

Vector space
Vector spaceVector space
Vector space
Mehedi Hasan Raju
 
Matrices and System of Linear Equations ppt
Matrices and System of Linear Equations pptMatrices and System of Linear Equations ppt
Matrices and System of Linear Equations ppt
Drazzer_Dhruv
 
Graph theory presentation
Graph theory presentationGraph theory presentation
Graph theory presentation
Aliul Kadir Akib
 
MATRICES AND ITS TYPE
MATRICES AND ITS TYPEMATRICES AND ITS TYPE
MATRICES AND ITS TYPE
Himanshu Negi
 
Eigenvalues and Eigenvectors
Eigenvalues and EigenvectorsEigenvalues and Eigenvectors
Eigenvalues and Eigenvectors
Vinod Srivastava
 
formulation of first order linear and nonlinear 2nd order differential equation
formulation of first order linear and nonlinear 2nd order differential equationformulation of first order linear and nonlinear 2nd order differential equation
formulation of first order linear and nonlinear 2nd order differential equation
Mahaswari Jogia
 
A study on number theory and its applications
A study on number theory and its applicationsA study on number theory and its applications
A study on number theory and its applications
Itishree Dash
 
Eigen values and eigenvectors
Eigen values and eigenvectorsEigen values and eigenvectors
Eigen values and eigenvectorsAmit Singh
 
Group abstract algebra
Group  abstract algebraGroup  abstract algebra
Group abstract algebra
NaliniSPatil
 
Linear algebra notes 1
Linear algebra notes 1Linear algebra notes 1
Linear algebra notes 1
Ghulam Murtaza
 
Introduction to Graph Theory
Introduction to Graph TheoryIntroduction to Graph Theory
Introduction to Graph Theory
Premsankar Chakkingal
 
Determinants - Mathematics
Determinants - MathematicsDeterminants - Mathematics
Determinants - Mathematics
Drishti Bhalla
 
Matrix and Determinants
Matrix and DeterminantsMatrix and Determinants
Matrix and Determinants
AarjavPinara
 
Applications of linear algebra in field of it
Applications of linear algebra in field of itApplications of linear algebra in field of it
Applications of linear algebra in field of it
university of Gujrat, pakistan
 
Eigen value and eigen vector
Eigen value and eigen vectorEigen value and eigen vector
Eigen value and eigen vector
Rutvij Patel
 
Eigen value , eigen vectors, caley hamilton theorem
Eigen value , eigen vectors, caley hamilton theoremEigen value , eigen vectors, caley hamilton theorem
Eigen value , eigen vectors, caley hamilton theorem
gidc engineering college
 
Principle of mathematical induction
Principle of mathematical inductionPrinciple of mathematical induction
Principle of mathematical induction
Kriti Varshney
 
02 linear algebra
02 linear algebra02 linear algebra
02 linear algebra
Ronald Teo
 

What's hot (20)

Vector space
Vector spaceVector space
Vector space
 
Matrices and System of Linear Equations ppt
Matrices and System of Linear Equations pptMatrices and System of Linear Equations ppt
Matrices and System of Linear Equations ppt
 
Graph theory presentation
Graph theory presentationGraph theory presentation
Graph theory presentation
 
MATRICES AND ITS TYPE
MATRICES AND ITS TYPEMATRICES AND ITS TYPE
MATRICES AND ITS TYPE
 
Set Theory Presentation
Set Theory PresentationSet Theory Presentation
Set Theory Presentation
 
Eigenvalues and Eigenvectors
Eigenvalues and EigenvectorsEigenvalues and Eigenvectors
Eigenvalues and Eigenvectors
 
formulation of first order linear and nonlinear 2nd order differential equation
formulation of first order linear and nonlinear 2nd order differential equationformulation of first order linear and nonlinear 2nd order differential equation
formulation of first order linear and nonlinear 2nd order differential equation
 
A study on number theory and its applications
A study on number theory and its applicationsA study on number theory and its applications
A study on number theory and its applications
 
Eigen values and eigenvectors
Eigen values and eigenvectorsEigen values and eigenvectors
Eigen values and eigenvectors
 
Group abstract algebra
Group  abstract algebraGroup  abstract algebra
Group abstract algebra
 
Linear algebra notes 1
Linear algebra notes 1Linear algebra notes 1
Linear algebra notes 1
 
Introduction to Graph Theory
Introduction to Graph TheoryIntroduction to Graph Theory
Introduction to Graph Theory
 
Determinants - Mathematics
Determinants - MathematicsDeterminants - Mathematics
Determinants - Mathematics
 
Matrix and Determinants
Matrix and DeterminantsMatrix and Determinants
Matrix and Determinants
 
Maths
MathsMaths
Maths
 
Applications of linear algebra in field of it
Applications of linear algebra in field of itApplications of linear algebra in field of it
Applications of linear algebra in field of it
 
Eigen value and eigen vector
Eigen value and eigen vectorEigen value and eigen vector
Eigen value and eigen vector
 
Eigen value , eigen vectors, caley hamilton theorem
Eigen value , eigen vectors, caley hamilton theoremEigen value , eigen vectors, caley hamilton theorem
Eigen value , eigen vectors, caley hamilton theorem
 
Principle of mathematical induction
Principle of mathematical inductionPrinciple of mathematical induction
Principle of mathematical induction
 
02 linear algebra
02 linear algebra02 linear algebra
02 linear algebra
 

Similar to LinearAlgebra.ppt

Linear_Algebra_Matrices.ppt
Linear_Algebra_Matrices.pptLinear_Algebra_Matrices.ppt
Linear_Algebra_Matrices.ppt
memevoltage
 
Bba i-bm-u-2- matrix -
Bba i-bm-u-2- matrix -Bba i-bm-u-2- matrix -
Bba i-bm-u-2- matrix -
Rai University
 
Engg maths k notes(4)
Engg maths k notes(4)Engg maths k notes(4)
Engg maths k notes(4)
Ranjay Kumar
 
matrix algebra
matrix algebramatrix algebra
matrix algebra
kganu
 
Presentation on matrix
Presentation on matrixPresentation on matrix
Presentation on matrix
Nahin Mahfuz Seam
 
ALLIED MATHEMATICS -I UNIT III MATRICES.ppt
ALLIED MATHEMATICS -I UNIT III MATRICES.pptALLIED MATHEMATICS -I UNIT III MATRICES.ppt
ALLIED MATHEMATICS -I UNIT III MATRICES.ppt
ssuser2e348b
 
1560 mathematics for economists
1560 mathematics for economists1560 mathematics for economists
1560 mathematics for economists
Dr Fereidoun Dejahang
 
Mathematics fundamentals
Mathematics fundamentalsMathematics fundamentals
Mathematics fundamentals
Sardar Alam
 
Applied Mathematics 3 Matrices.pdf
Applied Mathematics 3 Matrices.pdfApplied Mathematics 3 Matrices.pdf
Applied Mathematics 3 Matrices.pdf
PrasadBaravkar1
 
งานนำเสนอMatrix
งานนำเสนอMatrixงานนำเสนอMatrix
งานนำเสนอMatrix
krunittayamath
 
matrix-algebra-for-engineers (1).pdf
matrix-algebra-for-engineers (1).pdfmatrix-algebra-for-engineers (1).pdf
matrix-algebra-for-engineers (1).pdf
ShafaqMehmood2
 
MATRICES maths project.pptxsgdhdghdgf gr to f HR f
MATRICES maths project.pptxsgdhdghdgf gr to f HR fMATRICES maths project.pptxsgdhdghdgf gr to f HR f
MATRICES maths project.pptxsgdhdghdgf gr to f HR f
premkumar24914
 
งานนำเสนอMatrixของจริง
งานนำเสนอMatrixของจริงงานนำเสนอMatrixของจริง
งานนำเสนอMatrixของจริงNittaya Noinan
 
Matrix and its operations
Matrix and its operationsMatrix and its operations
Matrix and its operations
Pankaj Das
 
Chapter 3: Linear Systems and Matrices - Part 3/Slides
Chapter 3: Linear Systems and Matrices - Part 3/SlidesChapter 3: Linear Systems and Matrices - Part 3/Slides
Chapter 3: Linear Systems and Matrices - Part 3/Slides
Chaimae Baroudi
 
Matrix presentation By DHEERAJ KATARIA
Matrix presentation By DHEERAJ KATARIAMatrix presentation By DHEERAJ KATARIA
Matrix presentation By DHEERAJ KATARIA
Dheeraj Kataria
 
Matrices ,Basics, Determinant, Inverse, EigenValues, Linear Equations, RANK
Matrices ,Basics, Determinant, Inverse, EigenValues, Linear Equations, RANKMatrices ,Basics, Determinant, Inverse, EigenValues, Linear Equations, RANK
Matrices ,Basics, Determinant, Inverse, EigenValues, Linear Equations, RANK
Waqas Afzal
 
Matrices And Determinants
Matrices And DeterminantsMatrices And Determinants
Matrices And Determinants
DEVIKA S INDU
 

Similar to LinearAlgebra.ppt (20)

Linear_Algebra_Matrices.ppt
Linear_Algebra_Matrices.pptLinear_Algebra_Matrices.ppt
Linear_Algebra_Matrices.ppt
 
Bba i-bm-u-2- matrix -
Bba i-bm-u-2- matrix -Bba i-bm-u-2- matrix -
Bba i-bm-u-2- matrix -
 
Engg maths k notes(4)
Engg maths k notes(4)Engg maths k notes(4)
Engg maths k notes(4)
 
matrix algebra
matrix algebramatrix algebra
matrix algebra
 
Presentation on matrix
Presentation on matrixPresentation on matrix
Presentation on matrix
 
ALLIED MATHEMATICS -I UNIT III MATRICES.ppt
ALLIED MATHEMATICS -I UNIT III MATRICES.pptALLIED MATHEMATICS -I UNIT III MATRICES.ppt
ALLIED MATHEMATICS -I UNIT III MATRICES.ppt
 
1560 mathematics for economists
1560 mathematics for economists1560 mathematics for economists
1560 mathematics for economists
 
Mathematics fundamentals
Mathematics fundamentalsMathematics fundamentals
Mathematics fundamentals
 
Applied Mathematics 3 Matrices.pdf
Applied Mathematics 3 Matrices.pdfApplied Mathematics 3 Matrices.pdf
Applied Mathematics 3 Matrices.pdf
 
งานนำเสนอMatrix
งานนำเสนอMatrixงานนำเสนอMatrix
งานนำเสนอMatrix
 
matrix-algebra-for-engineers (1).pdf
matrix-algebra-for-engineers (1).pdfmatrix-algebra-for-engineers (1).pdf
matrix-algebra-for-engineers (1).pdf
 
MATRICES maths project.pptxsgdhdghdgf gr to f HR f
MATRICES maths project.pptxsgdhdghdgf gr to f HR fMATRICES maths project.pptxsgdhdghdgf gr to f HR f
MATRICES maths project.pptxsgdhdghdgf gr to f HR f
 
Matrices
MatricesMatrices
Matrices
 
งานนำเสนอMatrixของจริง
งานนำเสนอMatrixของจริงงานนำเสนอMatrixของจริง
งานนำเสนอMatrixของจริง
 
Matrix and its operations
Matrix and its operationsMatrix and its operations
Matrix and its operations
 
Chapter 3: Linear Systems and Matrices - Part 3/Slides
Chapter 3: Linear Systems and Matrices - Part 3/SlidesChapter 3: Linear Systems and Matrices - Part 3/Slides
Chapter 3: Linear Systems and Matrices - Part 3/Slides
 
Matrix algebra
Matrix algebraMatrix algebra
Matrix algebra
 
Matrix presentation By DHEERAJ KATARIA
Matrix presentation By DHEERAJ KATARIAMatrix presentation By DHEERAJ KATARIA
Matrix presentation By DHEERAJ KATARIA
 
Matrices ,Basics, Determinant, Inverse, EigenValues, Linear Equations, RANK
Matrices ,Basics, Determinant, Inverse, EigenValues, Linear Equations, RANKMatrices ,Basics, Determinant, Inverse, EigenValues, Linear Equations, RANK
Matrices ,Basics, Determinant, Inverse, EigenValues, Linear Equations, RANK
 
Matrices And Determinants
Matrices And DeterminantsMatrices And Determinants
Matrices And Determinants
 

Recently uploaded

一比一原版(QU毕业证)皇后大学毕业证成绩单
一比一原版(QU毕业证)皇后大学毕业证成绩单一比一原版(QU毕业证)皇后大学毕业证成绩单
一比一原版(QU毕业证)皇后大学毕业证成绩单
enxupq
 
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
axoqas
 
社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .
NABLAS株式会社
 
Q1’2024 Update: MYCI’s Leap Year Rebound
Q1’2024 Update: MYCI’s Leap Year ReboundQ1’2024 Update: MYCI’s Leap Year Rebound
Q1’2024 Update: MYCI’s Leap Year Rebound
Oppotus
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
ewymefz
 
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdfCh03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
haila53
 
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
ukgaet
 
Empowering Data Analytics Ecosystem.pptx
Empowering Data Analytics Ecosystem.pptxEmpowering Data Analytics Ecosystem.pptx
Empowering Data Analytics Ecosystem.pptx
benishzehra469
 
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
ewymefz
 
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
slg6lamcq
 
SOCRadar Germany 2024 Threat Landscape Report
SOCRadar Germany 2024 Threat Landscape ReportSOCRadar Germany 2024 Threat Landscape Report
SOCRadar Germany 2024 Threat Landscape Report
SOCRadar
 
FP Growth Algorithm and its Applications
FP Growth Algorithm and its ApplicationsFP Growth Algorithm and its Applications
FP Growth Algorithm and its Applications
MaleehaSheikh2
 
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
vcaxypu
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP
 
一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单
ewymefz
 
1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx
1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx
1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx
Tiktokethiodaily
 
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
mbawufebxi
 
一比一原版(BU毕业证)波士顿大学毕业证成绩单
一比一原版(BU毕业证)波士顿大学毕业证成绩单一比一原版(BU毕业证)波士顿大学毕业证成绩单
一比一原版(BU毕业证)波士顿大学毕业证成绩单
ewymefz
 
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
nscud
 
Best best suvichar in gujarati english meaning of this sentence as Silk road ...
Best best suvichar in gujarati english meaning of this sentence as Silk road ...Best best suvichar in gujarati english meaning of this sentence as Silk road ...
Best best suvichar in gujarati english meaning of this sentence as Silk road ...
AbhimanyuSinha9
 

Recently uploaded (20)

一比一原版(QU毕业证)皇后大学毕业证成绩单
一比一原版(QU毕业证)皇后大学毕业证成绩单一比一原版(QU毕业证)皇后大学毕业证成绩单
一比一原版(QU毕业证)皇后大学毕业证成绩单
 
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
 
社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .
 
Q1’2024 Update: MYCI’s Leap Year Rebound
Q1’2024 Update: MYCI’s Leap Year ReboundQ1’2024 Update: MYCI’s Leap Year Rebound
Q1’2024 Update: MYCI’s Leap Year Rebound
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
 
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdfCh03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
 
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
 
Empowering Data Analytics Ecosystem.pptx
Empowering Data Analytics Ecosystem.pptxEmpowering Data Analytics Ecosystem.pptx
Empowering Data Analytics Ecosystem.pptx
 
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
 
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
 
SOCRadar Germany 2024 Threat Landscape Report
SOCRadar Germany 2024 Threat Landscape ReportSOCRadar Germany 2024 Threat Landscape Report
SOCRadar Germany 2024 Threat Landscape Report
 
FP Growth Algorithm and its Applications
FP Growth Algorithm and its ApplicationsFP Growth Algorithm and its Applications
FP Growth Algorithm and its Applications
 
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
 
一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单
 
1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx
1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx
1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx
 
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
 
一比一原版(BU毕业证)波士顿大学毕业证成绩单
一比一原版(BU毕业证)波士顿大学毕业证成绩单一比一原版(BU毕业证)波士顿大学毕业证成绩单
一比一原版(BU毕业证)波士顿大学毕业证成绩单
 
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
 
Best best suvichar in gujarati english meaning of this sentence as Silk road ...
Best best suvichar in gujarati english meaning of this sentence as Silk road ...Best best suvichar in gujarati english meaning of this sentence as Silk road ...
Best best suvichar in gujarati english meaning of this sentence as Silk road ...
 

LinearAlgebra.ppt

  • 1. Linear Algebra and Matrices Methods for Dummies 21st October, 2009 Elvina Chu & Flavia Mancini
  • 2. Talk Outline • Scalars, vectors and matrices • Vector and matrix calculations • Identity, inverse matrices & determinants • Solving simultaneous equations • Relevance to SPM Linear Algebra & Matrices, MfD 2009
  • 3. Scalar • Variable described by a single number e.g. Intensity of each voxel in an MRI scan Linear Algebra & Matrices, MfD 2009
  • 4. Vector • Not a physics vector (magnitude, direction) • Column of numbers e.g. intensity of same voxel at different time points Linear Algebra & Matrices, MfD 2009           3 2 1 x x x
  • 5. Matrices • Rectangular display of vectors in rows and columns • Can inform about the same vector intensity at different times or different voxels at the same time • Vector is just a n x 1 matrix            4 7 6 1 4 5 3 2 1 A Square (3 x 3) Rectangular (3 x 2) d i j : ith row, jth column Defined as rows x columns (R x C)            8 3 7 2 4 1 C            33 32 31 23 22 21 13 12 11 d d d d d d d d d D Linear Algebra & Matrices, MfD 2009
  • 6. Matrices in Matlab • X=matrix • ;=end of a row • :=all row or column           9 8 7 6 5 4 3 2 1 Subscripting – each element of a matrix can be addressed with a pair of numbers; row first, column second (Roman Catholic) e.g. X(2,3) = 6 X(3, :) = X( [2 3], 2) =   9 8 7         8 5 “Special” matrix commands: • zeros(3,1) = • ones(2) = • magic(3) =         1 1 1 1           0 0 0 Linear Algebra & Matrices, MfD 2009           2 9 4 7 5 3 6 1 8
  • 7. Design matrix = a m b3 b4 b5 b6 b7 b8 b9 + e = b + Y X ´ Linear Algebra & Matrices, MfD 2009
  • 8. Transposition            2 1 1 b   2 1 1  T b   9 4 3  d column row row column            4 7 6 1 4 5 3 2 1 A            4 1 3 7 4 2 6 5 1 T A Linear Algebra & Matrices, MfD 2009            9 4 3 T d
  • 9. Matrix Calculations Addition – Commutative: A+B=B+A – Associative: (A+B)+C=A+(B+C) Subtraction - By adding a negative matrix                                 6 5 4 3 1 5 3 2 0 4 1 2 1 3 0 1 5 2 4 2 B A Linear Algebra & Matrices, MfD 2009
  • 10. Scalar multiplication • Scalar x matrix = scalar multiplication Linear Algebra & Matrices, MfD 2009
  • 11. Matrix Multiplication “When A is a mxn matrix & B is a kxl matrix, AB is only possible if n=k. The result will be an mxl matrix” A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 m n x B13 B14 B15 B16 B17 B18 l k Number of columns in A = Number of rows in B = m x l matrix Linear Algebra & Matrices, MfD 2009
  • 12. Matrix multiplication • Multiplication method: Sum over product of respective rows and columns  1 0 2 3               1 3 1 2         22 21 12 11 c c c c                   1) (3 1) (2 3) (3 2) (2 1) (0 1) (1 3) (0 2) (1         5 13 1 2 X = = = Define output matrix A B • Matlab does all this for you! • Simply type: C = A * B Linear Algebra & Matrices, MfD 2009
  • 13. Matrix multiplication • Matrix multiplication is NOT commutative • AB≠BA • Matrix multiplication IS associative • A(BC)=(AB)C • Matrix multiplication IS distributive • A(B+C)=AB+AC • (A+B)C=AC+BC Linear Algebra & Matrices, MfD 2009
  • 14. Vector Products Inner product XTY is a scalar (1xn) (nx1) Outer product XYT is a matrix (nx1) (1xn) xyT  x1 x2 x3           y1 y2 y3   x1y1 x1y2 x1y3 x2y1 x2y2 x2y3 x3y1 x3y2 x3y3             i i i T y x y x y x y x y y y x x x                  3 1 3 3 2 2 1 1 3 2 1 3 2 1 y x Inner product = scalar Two vectors:            3 2 1 x x x x            3 2 1 y y y y Outer product = matrix Linear Algebra & Matrices, MfD 2009
  • 15. Identity matrix Is there a matrix which plays a similar role as the number 1 in number multiplication? Consider the nxn matrix: For any nxn matrix A, we have A In = In A = A For any nxm matrix A, we have In A = A, and A Im = A (so 2 possible matrices) Linear Algebra & Matrices, MfD 2009
  • 16. Identity matrix 1 2 3 1 0 0 1+0+0 0+2+0 0+0+3 4 5 6 X 0 1 0 = 4+0+0 0+5+0 0+0+6 7 8 9 0 0 1 7+0+0 0+8+0 0+0+9 Worked example A I3 = A for a 3x3 matrix: • In Matlab: eye(r, c) produces an r x c identity matrix Linear Algebra & Matrices, MfD 2009
  • 17. Matrix inverse • Definition. A matrix A is called nonsingular or invertible if there exists a matrix B such that: • Notation. A common notation for the inverse of a matrix A is A-1. So: • The inverse matrix is unique when it exists. So if A is invertible, then A-1 is also invertible and then (AT)-1 = (A-1)T 1 1 X 2 3 -1 3 = 2 + 1 3 3 -1 + 1 3 3 = 1 0 -1 2 1 3 1 3 -2+ 2 3 3 1 + 2 3 3 0 1 • In Matlab: A-1 = inv(A) •Matrix division: A/B= A*B-1 Linear Algebra & Matrices, MfD 2009
  • 18. Matrix inverse • For a XxX square matrix: • The inverse matrix is: Linear Algebra & Matrices, MfD 2009 • E.g.: 2x2 matrix
  • 19. Determinants • Determinants are mathematical objects that are very useful in the analysis and solution of systems of linear equations (i.e. GLMs). • The determinant is a function that associates a scalar det(A) to every square matrix A. – Input is nxn matrix – Output is a single number (real or complex) called the determinant Linear Algebra & Matrices, MfD 2009
  • 20. Determinants •Determinants can only be found for square matrices. •For a 2x2 matrix A, det(A) = ad-bc. Lets have at closer look at that: • A matrix A has an inverse matrix A-1 if and only if det(A)≠0. • In Matlab: det(A) = det(A) Linear Algebra & Matrices, MfD 2009 a b c d det(A) = = ad - bc [ ]
  • 21. Solving simultaneous equations For one linear equation ax=b where the unknown is x and a and b are constants, 3 possibilities: If 0  a then b a a b x 1    thus there is single solution If 0  a , 0  b then the equation b ax  becomes 0 0  and any value of x will do If 0  a , 0  b then b ax  becomes b  0 which is a contradiction Linear Algebra & Matrices, MfD 2009
  • 22. With >1 equation and >1 unknown • Can use solution from the single equation to solve • For example • In matrix form b a x 1   1 2 5 3 2 2 1 2 1      x x x x A X = B                      1 5 2 1 3 2 2 1 x x X =A-1B Linear Algebra & Matrices, MfD 2009       4 1
  • 23. • X =A-1B • To find A-1 • Need to find determinant of matrix A • From earlier (2 -2) – (3 1) = -4 – 3 = -7 • So determinant is -7 bc ad d c b a A    ) det(        2 1 3 2 Linear Algebra & Matrices, MfD 2009  A1  1 det(A) d b c a      
  • 25. Linear Algebra & Matrices, MfD 2009 How are matrices relevant to fMRI data?
  • 26. Normalisation Statistical Parametric Map Image time-series Parameter estimates General Linear Model Realignment Smoothing Design matrix Anatomical reference Spatial filter Statistical Inference RFT p <0.05 Linear Algebra & Matrices, MfD 2009
  • 27. Linear Algebra & Matrices, MfD 2009 BOLD signal Time single voxel time series Voxel-wise time series analysis Model specification Parameter estimation Hypothesis Statistic SPM
  • 28. How are matrices relevant to fMRI data? = a m b3 b4 b5 b6 b7 b8 b9 + e = b + Y X ´ Linear Algebra & Matrices, MfD 2009 GLM equation N of scans
  • 29. How are matrices relevant to fMRI data? Y Response variable e.g BOLD signal at a particular voxel A single voxel sampled at successive time points. Each voxel is considered as independent observation. Preprocessing ... Intens ity Ti me Y Time Y = X . β + ε Linear Algebra & Matrices, MfD 2009
  • 30. How are matrices relevant to fMRI data? a m b3 b4 b5 b6 b7 b8 b9 b X ´ Explanatory variables – These are assumed to be measured without error. – May be continuous; – May be dummy, indicating levels of an experimental factor. Y = X . β + ε Solve equation for β – tells us how much of the BOLD signal is explained by X Linear Algebra & Matrices, MfD 2009
  • 31. In Practice • Estimate MAGNITUDE of signal changes • MR INTENSITY levels for each voxel at various time points • Relationship between experiment and voxel changes are established • Calculation and notation require linear algebra Linear Algebra & Matrices, MfD 2009
  • 32. Summary • SPM builds up data as a matrix. • Manipulation of matrices enables unknown values to be calculated. Y = X . β + ε Observed = Predictors * Parameters + Error BOLD = Design Matrix * Betas + Error Linear Algebra & Matrices, MfD 2009
  • 33. References • SPM course http://www.fil.ion.ucl.ac.uk/spm/course/ • Web Guides http://mathworld.wolfram.com/LinearAlgebra.html http://www.maths.surrey.ac.uk/explore/emmaspages/option1.ht ml http://www.inf.ed.ac.uk/teaching/courses/fmcs1/ (Formal Modelling in Cognitive Science course) • http://www.wikipedia.org • Previous MfD slides Linear Algebra & Matrices, MfD 2009