SlideShare a Scribd company logo
Matrices
by
L Surya
Department of CSA
KL Deemed to be university
Vijayawada, AP, India
Department of computer science and application
Contents
Applications of matrices
Creation of a matrix in R
 Perform mathematical operations on matrices
Access the elements of a matrix
Department of computer science and application
Department of computer science and technology
Outcomes
• Know the applications of matrices
• Creating a matrix
• Perform mathematical operations on matrices
• Access the elements of a matrix
At the end of this lecture you will be
able to
Applications of matrices
• Computer graphics
• Probability and statistics
• Game theory
• Algorithms
• Quantum mechanics
Matrix
Definition: Matrix is a collection of
elements of the same type and data
arranged in two dimensional.
[,1] [,2] [,3]
[1,] 10 11 12
[2,] 13 14 15
[3,] 16 17 18
[4,] 19 20 21
Matrix
[,1] [,2] [,3] [,4]
[1,] 100 101 102 103
[2,] 104 105 106 107
[3,] 108 109 110 111
[4,] 112 113 114 115
Department of computer science and technology
Matrix creation
A matrix is created using
The matrix() function.
Syntax:
matrix_name<-
matrix(data,nrow,ncol,byrow,dimnames)
Where
Data – means input
nrow- number of rows
ncol – number of columns
byrow- means logical . If TRUE then the input vector
elements are arranged by row.
dimnames-is the names for the rows and columns.
Matrix creation
> x
[,1] [,2] [,3]
[1,] 10 11 12
[2,] 13 14 15
[3,] 16 17 18
Department of computer science and technology
Matrix creation
[,1] [,2] [,3] [,4]
[1,] 100 101 102 103
[2,] 104 105 106 107
[3,] 108 109 110 111
[4,] 112 113 114 115
[,1] [,2] [,3]
[1,] 10 14 18
[2,] 11 15 19
[3,] 12 16 20
[4,] 13 17 21
Adding row & col names
[,1] [,2] [,3]
[1,] 10 11 12
[2,] 13 14 15
[3,] 16 17 18
[4,] 19 20 21
col1 col2 col3
row1 10 11 12
row2 13 14 15
row3 16 17 18
row4 19 20 21
Adding row & col names
Accessing the elements of matrix
Access the elements of a matrix by using
The column and row index of the element.
Syn:Matrix_name[row,column]
Ex: to access 3rd
row 2nd
column
>x[3,2]
Accessing the elements of matrix
[,1] [,2] [,3]
[1,] 10 11 12
[2,] 13 14 15
[3,] 16 17 18
[4,] 19 20 21
To access column
>
To access row column
>
To access only row
>
To access only column
>
Operations on matrices
Operations that can be done on matrices are
Arithmetic operations
-->Addition
-->Subtraction
-->Multiplication
-->Division
Matrices
>x=matrix(c(10:18),nrow=3,
byrow=TRUE)
>y=matrix(c(1:9),nrow=3,
byrow=TRUE)
>
[,1] [,2] [,3]
[1,]
[2,]
[3,]
[,1] [,2] [,3]
[1,]
[2,]
[3,]
[,1] [,2] [,3]
[1,]
[2,]
[3,]
Thank You

More Related Content

PPTX
Vectors.pptx
PDF
R Programming Homework Help
PPT
R Programming Intro
PPT
Multi dimensional arrays
PPTX
Matlab-1.pptx
PDF
Basic operations by novi reandy sasmita
PDF
DS-lect2.pdf data structure in c ++ engineering
PPTX
Introduction to MATLAB
Vectors.pptx
R Programming Homework Help
R Programming Intro
Multi dimensional arrays
Matlab-1.pptx
Basic operations by novi reandy sasmita
DS-lect2.pdf data structure in c ++ engineering
Introduction to MATLAB

Similar to Matrices(teaching)Matrices(teaching)Matrices(teaching)Matrices(teaching)Matrices(teaching)Matrices(teaching)Matrices(teaching) ppt.pptx (20)

PDF
Computer Science CS Project Matrix CBSE Class 12th XII .pdf
PPT
Chapter 3 ds
PPT
R tutorial for a windows environment
PPTX
Data Structure_Array_and_sparse matrix.pptx
PPTX
Programming in R
PDF
Matrix algebra in_r
PPTX
MATLAB - Arrays and Matrices
PPTX
R Programming Tutorial for Beginners - -TIB Academy
PPTX
PDF
Day 1c access, select ordering copy.pptx
PPT
473431331-Matlab-Simulink-Tutorial-ppt.ppt
PPTX
data structure and algorithm Array.pptx btech 2nd year
PPTX
Radix Sort
PPTX
Unit 3
PPTX
Arrays with the help of Computer Programming
PPTX
R Programming.pptx
PDF
An Introduction Linear Algebra for Neural Networks and Deep learning
PPT
Introduction of MatLab
PDF
PPT
Matlab an Introduction_Lecture_for all.ppt
Computer Science CS Project Matrix CBSE Class 12th XII .pdf
Chapter 3 ds
R tutorial for a windows environment
Data Structure_Array_and_sparse matrix.pptx
Programming in R
Matrix algebra in_r
MATLAB - Arrays and Matrices
R Programming Tutorial for Beginners - -TIB Academy
Day 1c access, select ordering copy.pptx
473431331-Matlab-Simulink-Tutorial-ppt.ppt
data structure and algorithm Array.pptx btech 2nd year
Radix Sort
Unit 3
Arrays with the help of Computer Programming
R Programming.pptx
An Introduction Linear Algebra for Neural Networks and Deep learning
Introduction of MatLab
Matlab an Introduction_Lecture_for all.ppt
Ad

Recently uploaded (20)

PPTX
IB Computer Science - Internal Assessment.pptx
PPTX
DISORDERS OF THE LIVER, GALLBLADDER AND PANCREASE (1).pptx
PDF
Lecture1 pattern recognition............
PPTX
MODULE 8 - DISASTER risk PREPAREDNESS.pptx
PDF
“Getting Started with Data Analytics Using R – Concepts, Tools & Case Studies”
PPTX
Moving the Public Sector (Government) to a Digital Adoption
PPTX
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
PPTX
Supervised vs unsupervised machine learning algorithms
PPTX
CEE 2 REPORT G7.pptxbdbshjdgsgjgsjfiuhsd
PPTX
Business Ppt On Nestle.pptx huunnnhhgfvu
PDF
Introduction to Business Data Analytics.
PDF
BF and FI - Blockchain, fintech and Financial Innovation Lesson 2.pdf
PPTX
Introduction to Basics of Ethical Hacking and Penetration Testing -Unit No. 1...
PDF
Galatica Smart Energy Infrastructure Startup Pitch Deck
PPT
Reliability_Chapter_ presentation 1221.5784
PPTX
IBA_Chapter_11_Slides_Final_Accessible.pptx
PDF
Foundation of Data Science unit number two notes
PDF
Fluorescence-microscope_Botany_detailed content
PPTX
05. PRACTICAL GUIDE TO MICROSOFT EXCEL.pptx
IB Computer Science - Internal Assessment.pptx
DISORDERS OF THE LIVER, GALLBLADDER AND PANCREASE (1).pptx
Lecture1 pattern recognition............
MODULE 8 - DISASTER risk PREPAREDNESS.pptx
“Getting Started with Data Analytics Using R – Concepts, Tools & Case Studies”
Moving the Public Sector (Government) to a Digital Adoption
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
Supervised vs unsupervised machine learning algorithms
CEE 2 REPORT G7.pptxbdbshjdgsgjgsjfiuhsd
Business Ppt On Nestle.pptx huunnnhhgfvu
Introduction to Business Data Analytics.
BF and FI - Blockchain, fintech and Financial Innovation Lesson 2.pdf
Introduction to Basics of Ethical Hacking and Penetration Testing -Unit No. 1...
Galatica Smart Energy Infrastructure Startup Pitch Deck
Reliability_Chapter_ presentation 1221.5784
IBA_Chapter_11_Slides_Final_Accessible.pptx
Foundation of Data Science unit number two notes
Fluorescence-microscope_Botany_detailed content
05. PRACTICAL GUIDE TO MICROSOFT EXCEL.pptx
Ad

Matrices(teaching)Matrices(teaching)Matrices(teaching)Matrices(teaching)Matrices(teaching)Matrices(teaching)Matrices(teaching) ppt.pptx

  • 1. Matrices by L Surya Department of CSA KL Deemed to be university Vijayawada, AP, India Department of computer science and application
  • 2. Contents Applications of matrices Creation of a matrix in R  Perform mathematical operations on matrices Access the elements of a matrix Department of computer science and application
  • 3. Department of computer science and technology Outcomes • Know the applications of matrices • Creating a matrix • Perform mathematical operations on matrices • Access the elements of a matrix At the end of this lecture you will be able to
  • 4. Applications of matrices • Computer graphics • Probability and statistics • Game theory • Algorithms • Quantum mechanics
  • 5. Matrix Definition: Matrix is a collection of elements of the same type and data arranged in two dimensional.
  • 6. [,1] [,2] [,3] [1,] 10 11 12 [2,] 13 14 15 [3,] 16 17 18 [4,] 19 20 21 Matrix [,1] [,2] [,3] [,4] [1,] 100 101 102 103 [2,] 104 105 106 107 [3,] 108 109 110 111 [4,] 112 113 114 115 Department of computer science and technology
  • 7. Matrix creation A matrix is created using The matrix() function. Syntax: matrix_name<- matrix(data,nrow,ncol,byrow,dimnames) Where Data – means input nrow- number of rows ncol – number of columns byrow- means logical . If TRUE then the input vector elements are arranged by row. dimnames-is the names for the rows and columns.
  • 8. Matrix creation > x [,1] [,2] [,3] [1,] 10 11 12 [2,] 13 14 15 [3,] 16 17 18 Department of computer science and technology
  • 9. Matrix creation [,1] [,2] [,3] [,4] [1,] 100 101 102 103 [2,] 104 105 106 107 [3,] 108 109 110 111 [4,] 112 113 114 115 [,1] [,2] [,3] [1,] 10 14 18 [2,] 11 15 19 [3,] 12 16 20 [4,] 13 17 21
  • 10. Adding row & col names [,1] [,2] [,3] [1,] 10 11 12 [2,] 13 14 15 [3,] 16 17 18 [4,] 19 20 21 col1 col2 col3 row1 10 11 12 row2 13 14 15 row3 16 17 18 row4 19 20 21
  • 11. Adding row & col names
  • 12. Accessing the elements of matrix Access the elements of a matrix by using The column and row index of the element. Syn:Matrix_name[row,column] Ex: to access 3rd row 2nd column >x[3,2]
  • 13. Accessing the elements of matrix [,1] [,2] [,3] [1,] 10 11 12 [2,] 13 14 15 [3,] 16 17 18 [4,] 19 20 21 To access column > To access row column > To access only row > To access only column >
  • 14. Operations on matrices Operations that can be done on matrices are Arithmetic operations -->Addition -->Subtraction -->Multiplication -->Division