Procedures to find solution to $a_1x_1+\cdots+a_nx_n = 0$ Suppose that $x_1, \dots,x_n$ are given as an input. Then we want to find $a_1,\ldots,a_n$ that satisfy $a_1x_1 + a_2x_2+a_3x_3 + a_4x_4+\cdots +a_nx_n =0$. (including the case where such $a$ set does not exist.)
How does one find this easily? (So I am asking for an algorithm.)
Edit: all numbers are non-zero integers. 

If you want $a_1x_1+\cdots+a_nx_n = 0$ then you are asking for the vectors $(a_1,\ldots,a_n)$ and $(x_1,\ldots,x_n)$ to be perpendicular, i.e. at right angles to one another. For a fixed $(x_1,\ldots,x_n)$ there is an $(n-1)$-dimensional set of vectors $(a_1,\ldots,a_n)$ for which ${\bf x} \perp {\bf a}.$ To see this, think of a flag pole $(0,0,1)$. The $2$-dimensional ground is made up of all of the vectors perpendicular to the flag pole.
Assume that ${\bf x}$ is non-zero. Then one of the $x_i$ will be non-zero. Let us assume that $x_k \neq 0$ and we want to find $(a_1,\ldots,a_n)$ such that $a_1x_1+\cdots+a_nx_n = 0$, well, clearly:
$$a_k = -\frac{1}{x_k}(a_1x_1+\cdots+a_{k-1}x_{k-1}+a_{k+1}x_{k+1}+\cdots+a_nx_n) \, . $$
Thus, all of the vectors can be generated by choosing arbitrary $(a_1,\ldots,a_{k-1},a_{k+1},\ldots,a_n)$ and putting them into:
$$\left(a_1,\ldots,a_{k-1},-\frac{1}{x_k}(a_1x_1+\cdots+a_{k-1}x_{k-1}+a_{k+1}x_{k+1}+\cdots+a_nx_n),a_{k+1},\ldots,a_n\right) \, . $$
Note that if ${\bf x}$ is zero then all choice of ${\bf a}$ satisfy your equation.
