{"id":20290,"date":"2021-09-09T19:57:45","date_gmt":"2021-09-09T14:27:45","guid":{"rendered":"https:\/\/python-programs.com\/?p=20290"},"modified":"2021-11-22T18:36:23","modified_gmt":"2021-11-22T13:06:23","slug":"python-program-to-find-the-normal-and-trace-of-a-matrix","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-find-the-normal-and-trace-of-a-matrix\/","title":{"rendered":"Python Program to find the Normal and Trace of a Matrix"},"content":{"rendered":"

In the previous article, we have discussed Python Program to Print Odd Numbers in Given Range Using Recursion<\/a><\/p>\n

Given a matrix and the task is to find the normal and trace of the given Matrix in Python.<\/p>\n

What is a matrix:<\/strong><\/p>\n

A matrix is a rectangular sequence of numbers divided into columns and rows. A matrix element or entry is a number that appears in a matrix.<\/p>\n

Example:<\/strong><\/p>\n

\"\"<\/p>\n

Above is the matrix which contains 5 rows and 4 columns and having elements from 1 to 20.<\/p>\n

In this order, the dimensions of a matrix indicate the number of rows and columns.<\/p>\n

Here as there are 5 rows and 4 columns it is called a 5*4 matrix.<\/p>\n

Normal of a matrix:<\/strong><\/p>\n

The sum of squares is normal for all the matrix entries.<\/p>\n

Trace of a matrix:<\/strong><\/p>\n

Trace is the sum of the Matrix’s diagonal parts.<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given Matix :\r\n2 6 4 \r\n8 5 3 \r\n1 6 8<\/pre>\n

Output:<\/strong><\/p>\n

The trace value of the given matrix is : 15\r\nThe normal value of the given matrix is : 6.557438524302<\/pre>\n

Example2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given Matix : \r\n1 2 3 4\r\n7 5 8 6\r\n9 4 2 5\r\n1 1 1 1<\/pre>\n

Output:<\/strong><\/p>\n

The trace value of the given matrix is : 9\r\nThe normal value of the given matrix is : 7.745966692414834<\/pre>\n

Program to find the Normal and Trace of a Matrix in Python<\/h2>\n

Below are the ways to find the normal and trace of the given Matrix in Python:<\/p>\n