# BackSub

Advanced Analysis Library Only

AnalysisLibErrType BackSub (void *inputMatrixA, double knownVectorY[], int arraySizes, double outputVectorX[]);

## Purpose

Solves the linear equations a × x = y by backward substitution. BackSub assumes the input matrix is a lower triangular matrix whose diagonal elements are all ones. BackSub obtains x using the following formulas:

The input matrix must be a lower triangular matrix or a matrix obtained from LU decomposition.

BackSub can perform the operation in place; that is, the input and output arrays can be the same. Use BackSub in conjunction with LU and ForwSub to solve linear equations.

### Example

/* to solve a linear equation A*x = y */
double A[10][10], x[10], y[10];
int p[10]; /* permutation vector */
int sign, n;
n = 10;
LU(A, n, p, &sign); /* LU decomposition of A */
ForwSub(A, y, n, x, p); /* forward substitution */
BackSub(A, x, n, x); /* backward substitution */

## Parameters

Input
Name | Type | Description
inputMatrixA | numeric array | Input square matrix. inputMatrixA can be either a lower triangular matrix or a matrix from the LU decomposition. This matrix must be an array of doubles.
knownVectorY | double-precision array | The array that represents the set of known vector coefficients.
arraySizes | integer | The number of rows and columns in the square input matrix and the number of elements in the known vector array.
Output
Name | Type | Description
outputVectorX | double-precision array | Solution vector.

## Return Value

Name | Type | Description
status | AnalysisLibErrType | A value that specifies the type of error that occurred. Refer to analysis.h for definitions of these constants.