  We propose a protocol for solving systems of linear algebraic equations via
quantum mechanical methods using the minimal number of qubits. We show that
$(M+1)$-qubit system is enough to solve a system of $M$ equations for one of
the variables leaving other variables unknown provided that the matrix of a
linear system satisfies certain conditions. In this case, the vector of input
data (the rhs of a linear system) is encoded into the initial state of the
quantum system. This protocol is realized on the 5-qubit superconducting
quantum processor of IBM Quantum Experience for particular linear systems of
three equations. We also show that the solution of a linear algebraic system
can be obtained as the result of a natural evolution of an inhomogeneous
spin-1/2 chain in an inhomogeneous external magnetic field with the input data
encoded into the initial state of this chain. For instance, using such
evolution in a 4-spin chain we solve a system of three equations.
