Reference no: EM133423586
Question: Mathlab coding using Symbolic Math Toolbox
Part (a)
Let n be an odd positive integer. Let M be the n × n matrix whose entry in row i and column j is given by Mi,j = i + j - 2 ( if i + j - 2 < n ) and i + j - 2 - n (otherwise). For example, when n = 3 the matrix
M is [0 1 2: 1 2 0: 2 0 1]
Since the entries of M are integer numbers, the determinant of M is an integer number. Parts (a)-(d) are concerned with discovering the formula for det(M) when n is odd.
write function M that accepts n on input and it returns the matrix M. You can use nested for-loops. Use sym (symbolic numbers) to define the entries of the matrix. You do not need to pre-allocate the matrix before you fill it in.
Part (b)
Make a call to your function M with input 3 to test its correctness, by comparing the output to the 3 × 3 matrix shown above.
Part (c)
For n = 1, 3, 5, . . . compute the determinant of M and its factorization into prime numbers. (For negative numbers, the factorization will also include the "prime" -1.) Note that factor() only permits positive integers on input. You will see a strong pattern in the results. Based on this pattern, guess the formula for det(M) for general odd integer n.
Part (d)
Write Matlab function G that accepts odd integer n on input and it returns your guessed value of the determinant. Remember to use symbolic numbers as you did in part (a). For odd values of n such that 1 ≤ n ≤ 15 verify the correctness of your guessed formula.
Part (e)
Denote by T the following 4 × 4 matrix, where z is a symbolic variable.
T=[z 1 0 0; 3 z 2 0; 0 2 z 3; 0 0 1 z ]
Determine all values of z for which T is not invertible. Do this by solving a suitable equation involving det(T). For each such value of z, substitute it for z in T and determine a basis for the null space of the resulting matrix (which is now free of z). You can use a for loop.