 Hello friends, I am Nawal Emul working as an assistant professor in mechanical engineering department Valchan Institute of Technology, Solapur. In this video, we are going to see Sylab mattresses Learning outcome at the end of this session students will be able to perform basic matrix operations on Sylab Content of the video is Introduction Arithmetic operations for mattresses basic matrix operations Introduction a matrix in layman's language is tabular data arranged in rows and columns Let us see an example of a matrix a Matrix a with three rows and three columns This can be defined in Sylab in a single line with rows Separated by the semicolon in the previous video I have shown you how the Sylab vector or Row vector and the column vector is defined in Sylab. So here if you want to define a matrix, we need to Define in a single line with the rows separated by a semicolon So when you enter this in Sylab, you get output like this So we'll have a quick We'll take an input a is equal to a square bracket 11 comma 12 comma indicates it is in row Semicolon indicates it will shift in the second column 21 space you can give comma also 22 comma 23 then semicolon then 31 comma 32 comma 33 Bracket complete enter. So this is a Matrix a with three element three rows and three columns So any element of the matrix can be referred to by specifying its row and column indices If you want to access the second element of the first row We may refer to it as a 1 comma 2 that one refers row and this two refers column For example, these are the columns and these are the rows So here 1 comma 2 refers first row first row and second column here So if you want to specify or if you want to access to this second element So the function will be a 1 comma 2 So when you press a 1 comma 2 in a curly bracket, you get output as 12. We'll just check in Sylab here so a capital A because we have defined as capital A 1 comma 2 When you press enter, so it will be Access that is 12 the element 1 comma 2 position is shown here so next In the same way if you want to show the position of 2 comma 3 it will be 23. You can just check here a 2 comma 3 So here that is second row third column the element is 23 when you press enter you get the second row third element Next to overwrite any defined value we can simply reassign it by using a 2 comma 3 is equal to 0 you can assign any value to any element or any position So it is very simple. The output will be like this So the third second row third column is re overrided by 0 You can try this with name different numbers also. So a 2 comma 3 Should be assigned or should be equal to suppose 0 5 just press enter. So this third Second row third element. So this position is replaced by number five. You can try with different numbers Sorry, so a capital A 2 comma 3 is equal to 0 When you press enter, so 2 comma 3 is replaced as 0 you can try with different positions also for example a 1 comma 2 should be replaced with 3 Just press enter. So this 1 comma 2 that is first row and second column is replaced by number 3 You can replace any number with any position The command will be the we call matrix A in a round bracket. First we'll call row then column So the next arithmetic operators for matrix So basic arithmetic addition subtraction and multiplication are done on matrices in Sylab in exactly the same way as they are traditionally defined in mathematics These operations work only if the size of the matrix are compatible That is the size of the matrix should be same There only this basic mathematics are performed in case of addition and subtraction the matrices I have to be exactly the same dimension and in the case of multiplication also the matrix Should be of same dimensions Here I have defined two matrices A and B A and B I have done the addition of these two matrices That is I have taken in the third variable C A plus B matrix A added with matrix B The output would be this one three five seven nine This is basic what we do in a matrix addition. I just clear this all The out the command for clearing the console window is CLC Suppose I take an A matrix Is equal to One space to comma semicolon three space or comma four Enter the then I have taken semicolon four comma five just present that the B is defined So there are two matrix A and B Suppose if you want to add these two matrix in a new variable called C You can write C is equal to A plus B and just type enter You get the addition of these two matrices In the same way you can take A minus B and the Substraction operator you B uses minus just present that you get Substraction of matrix A and B So it is very simple So B minus A or A minus B you can perform any operation And multiplication also very easy A we use a strict sign or a strict symbol into B You get multiplication of the two vectors So pause the video for few seconds and think What all matrix operations you can perform on Sylab apart from this addition Substraction multiplication what you can perform Pause the video for few seconds and think on this Okay, so we'll discuss this question later on in the video. So basic matrix operations In this section, we shall see how to handle a matrix including a navigation through it in special ways And implementing common operations such as transpose inverse, etc One of these basic information about the matrix is its dimension For two dimensional matrix It is of the form m comma n where m is number of rows and n is number of columns as I have discussed in the previous video We can use size function So here size function is used in Sylab to determine the dimensions of a matrix as demonstrated below Suppose I have taken a matrix that is a matrix of three rows and three columns And when I use a function size of a The command or the function is size of a the output would be three And three that it shows three rows and three columns. So we'll perform this operation in Sylab So first I'll clear the console window Then I'll take a new matrix I'll just press enter. So when I type size of a And just press enter it shows three and three that has three rows and three columns So in the same way the function diagonal To finding the diagonal elements the function is di ag And curly bracket or drowned brackets. So the function di ag of matrix shows the diagonal elements To find the sum of diagonal elements The function is trace. So you need to remember trace is finding the sum of diagonal elements So trace of matrix a gives the sum of all diagonal elements The lower triangular matrix whose elements above diagonal elements are zero is obtained by using Try l that is try lower triangular So the function is try l of a it gives you the lower triangular matrix in the same manner you can go with Upper triangular matrix for upper triangular matrix. The function is try you And you can find the transpose of the matrix And it is very simple that is a dash gives you the transpose of the matrix So here if I want to find The diagonal di Ag diagonal of a and if I enter you get the Diagonal elements here and if you want to sum those diagonal element the command is trace Of a just press enter you'll get sum of all the diagonal elements And if you want to find the upper triangular matrix or lower triangular matrix the command or the function is Try l of matrix a so here Above the diagonal elements all the elements become zero in the same way. I can use try u of a Just press enter so diagonal elements below it becomes zero that is called upper triangular Matrix so you can find a inverse also just write a dash And enter it so your columns are converted into rows and your rows are converted into So these are the references I have used Thank you