Category Archives: Mathematical

Adjoint and Inverse of a Matrix

Given a square matrix, find adjoint and inverse of the matrix. We strongly recommend you to refer below as a prerequisite of this. Determinant of a Matrix What is Adjoint? Adjoint (or Adjugate) of a matrix is the matrix obtained by taking transpose of the cofactor matrix of a given square matrix is called its… Read More »

Sieve of Atkin

Given a limit, print all primes smaller than or equal to the given limit. Examples: Input: limit = 10 Output: 2, 3, 5, 7 Input: limit = 20 Output: 2, 3, 5, 7, 11, 13, 17, 19 We have discussed below algorithms for the above task. Sieve of Eratosthenes Sieve of Sundaram The sieve of… Read More »

Determinant of a Matrix

What is Determinant of a Matrix? Determinant of a Matrix is a special number that is defined only for square matrices (matrices which have same number of rows and columns). Determinant is used at many places in calculus and other matrix related algebra, it actually represents the matrix in term of a real number which… Read More »

Program for Newton Raphson Method

Given a function f(x) on floating number x and an initial guess for root, find root of function in interval. Here f(x) represents algebraic or transcendental equation. For simplicity, we have assumed that derivative of function is also provided as input. Example: Input: A function of x (for example x3 – x2 + 2), derivative… Read More »

Program for Bisection Method

Given a function f(x) on floating number x and two numbers ‘a’ and ‘b’ such that f(a)*f(b) < 0 and f(x) is continuous in [a, b]. Here f(x) represents algebraic or transcendental equation. Find root of function in interval [a, b] (Or find a value of x such that f(x) is 0). Input: A function… Read More »

Gaussian Elimination to Solve Linear Equations

The article focuses on using an algorithm for solving a system of linear equations. We will deal with the matrix of coefficients. Gaussian Elimination does not work on singular matrices (they lead to division by zero). Input: For N unknowns, input is an augmented matrix of size N x (N+1). One extra column is for… Read More »