Consider system $Ax = b, x = (x_1,\ldots, x_n)^T$. Suppose that some of variable $x_i$ is known. How can I find the rest of unknown variable effectively? Assume that system has unique solutions after we substitute all known variables $x_i$.
One way to do it is manually substituting the known variable and rewrite the system in different form then we can solve system by some method like $QR$ decomposition, ....But it seems to be not effectively and difficult if I have to write a program. For example, how can I write a program in Matlab with input $A,b$ and some known variable $x_i$, output: find the rest unknown variables ? Thank you for your time.
Apply a permutation matrix so that the known values of $x$ are all at the bottom of the vector.
Then, your system is
$$A\begin{bmatrix}x_{unknown}\\x_{known}\end{bmatrix} = \begin{bmatrix}b_{unknown}\\b_{known}\end{bmatrix}$$
Now, you can also write $A$ as a block matrix $$A=\begin{bmatrix}A_{11}&A_{12}\\A_{21}&A_{22}\end{bmatrix}$$and get a new, smaller system to solve, since
$$A_{11} x_{unknown} + A_{12} x_{known} = b_{unknown}$$
meaning that $$A_{11}x_{unknown} = b^*$$
where $b^*=b_{unknown} - A_{12}x_{known}$