"<
Before proceeding, I am assuming you know how to find minors of a 3x3 matrix and how to find cofactors using minors.
But if the user enters 2 instead of 1 in ch, which means he wants to find the adjoint of a 3x3 matrix, then calculations will be like this.
Adjoint is actually a matrix in which the elements in the rows of cofactors will be in the stored in adjoint matrix AD2 as columns. After cofactors are calculated, we calculate the adjoint of a matrix.For a 2x2 matrix, cofactors can be calculated like this:-įor common, cofactors for 2x2 matrix is calculated as, C=(-1) (i+j)*(element of A at another end of diagonal). After taking elements of the matrix, cofactors of a given matrix is calculated.The elements of the matrix provided by the user are stored in A2. If the input provided by the user is 1 (which is for the 2x2 matrix), the user is asked to provide elements of the 2x2 matrix.The input for this given by the user is stored in ch. First, the user is asked to provide the order of the matrix, for which he/she want to find adjoint.