Posts

mathajax

Take the Test on ProQuiz!

Are You as Good a Programmer as You Think?  As developers, we spend hours writing code, reading documentation, and building software. But how often do we actually test our core foundational knowledge? Whether you are preparing for technical interviews, learning a new language, or just want to prove your expertise, taking structured coding tests is one of the fastest ways to find your knowledge gaps. If you are ready to test your programming skills, I highly recommend checking out ProQuiz . Why Take a Coding Test on ProQuiz? 🎯 Validate Your Knowledge: Move past "tutorial hell." Writing code is great, but answering conceptual and syntax-based questions tests your deep understanding. ⚡ Brushing Up for Interviews: The site features quick, targeted tests on syntax, memory management, OOP principles, and structure. Perfect for a pre-interview warmup! 🚀 Five Essential Languages: Challenge yourself in C, C++, Java, Kotlin, or Python . 🆓 Instant & Fricti...

Inverse Matrix by LU Decomposition

One of the application of LU matrix decomposition finds inverse of a square matrix,A. A A -1 = I The square matrix (coefficient matrix) A decomposed into LU (lower triangular and upper triangular) matrix by elementary-row-operations . A = LU after that, inverse matrix A -1 is found by applying forward and back substitution on each column of identity matrix, I and place returning solution vectors x to column of A -1 matrix. Algorithm steps for Matrix Inverse by LU Decomposition Input : a square matrix , A Output : a square matrix, A -1 read matrix A [L,U]= LUDecompose (A) [nrow,ncol]=size(A) I = Identity-matrix(nrow,ncol); iA = zero-matrix(nrow,ncol); For c =1 to ncol Y = forward-substitute (L,I(c)) X = back-substitute (U,Y) A -1 (c,:) = X // set vector X to column of A -1 ...

Solve System of Linear Equations by LU Decompose

Image
One of the application of LU matrix decomposition is solving system of linear equations. Ax = b A - coefficient matrix b - non-homogeneous vector x - unknown vector (solution vector) The square matrix (coefficient matrix) A decomposed into LU (lower triangular and upper triangular) matrix by elementary-row-operations. A = LU the solution vector X of system found by forward and back substitution. y = forward-substitute L and b X = back-substitute U and y The two or more system of equations have same coefficient matrix A but have different non-homogeneous vectors (b1 ,b2,..), the solutions vectors (x1,x2,..) obtained by once applying LU decomposition over matrix A. System 1 &nbsp&nbsp Ax = b1 ...

Matrix Forward and Back Substitution

Image
A square matrix is transformed into a Lower triangular matrix L or an Upper triangular matrix U by applying elementary row operation (Gaussian elimination) for solving system linear of equations. A solution vector X of system of linear equations is obtained by applying substitution method. The forward substitution method is applied to matrix L The back substitution method is applied to matrix U Algorithm steps for forward substitution to matrix L Input : a square matrix, A a non-homogeneous vector b Output : Solution vector, X read matrix A read vector b L = transform_to_L (A,b) X = substitute-forward(L); Example of forward substitution to matrix L substitute unknown variables top to bottom approach 0.4286x = 1.7143 3.6667x + 2.3334y = 10.0 2.0x+ + 4.0y + 6.0z = 18.0 find x, from equation 1 ...

Matrix A = LU Decompose

Image
LU decompose - a square matrix A that can be expressed as product of L and U matrix, is called LU decomposition. A = LU Matrix L - It is called Lower triangular Matrix , whose elements above the main diagonal is zero valued elements. Matrix U - It is called Upper Triangular Matrix , whose elements below the main diagonal is zero valued elements. How to LU decompose - a square matrix A is decomposed or factorized into L and U matrix by elementary row operation , such as swapping two rows and adding or subtracting row by a scalar value. Application of LU decompose It is useful to find solution of system of linear equation and matrix inverse. Algorithm steps for A= LU decompose Read matrix A U = copy (A) L = Identity-matrix() i,j - position of a element in the matrix For i=1 To N Eor j=i+1 To N lambda=U ji /U ii R j <- R j - lambda ...

Matrix Determinant by Diagonal Matrix

Image
A matrix diagonal transformation method is preferred over minor or cofactor of matrix method while finding determinant of the matrix's size over 3x3. The matrix A is converted into Diagonal matrix D by elementary row operation or reduction and then product of main diagonal elements is called determinant of the matrix A. Read matrix A Convert matrix A into diagonal matrix D by applying Row operation or reduction technique Read Main Diagonal elements from D Determinant = product of Main Diagonal elements Algorithm steps for Determinant by Diagonal matrix Read matrix A a - element of the matrix A i,j - position of a element in the matrix for i=1 To N for j=1 To N if i not-equal j RowOperation .add(j,i ,-a ii /a ji ) end end end Determinant = a 11 x a 22 x ... x a nn Java program for a matrix Determinant by Diagonal matrix public class Determinant { Matrix mat; publ...

Matrix Determinant by Lower Triangular Matrix

Image
Determinant, a properties of matrix determines the matrix is singular or not. Lower Triangular matrix transformation method is preferred over minor or cofactor of matrix method while finding determinant of the matrix's size over 3x3. The matrix A is converted into Lower triangular matrix, L by elementary row operation or reduction and then product of main diagonal elements is called determinant of the matrix A. Read matrix A Convert matrix A into L by applying Row operation or reduction technique Read Main Diagonal elements from L Determinant = product of Main Diagonal elements Algorithm steps for Determinant by Lower Triangular Matrix Read matrix A a - elements of matrix A i,j - position of a element in the matrix for i=N-1 To 1 decrement by -1 for j=i-1 To 1 decrement by -1 RowOperation.add(j,i ,-a ii /a ji ) end end Determinant = a 11 x a 22 x ... x a nn Java progr...