Linear independence when writing a function as a sum of functions. Consider splitting a two-variable function into a sum of products of one-variable functions like this:
$$f(x,y) = \sum_{i=1}^n g_i(x) \cdot h_i(y)$$
Such a decomposition is called irreducible if the $g_i$ are linearly independent, and the $h_i$ are linearly independent. The rank of a decomposition is the number of terms in the (finite) sum, and the rank of the function $f(x,y)$ is the minimum rank over all possible decompositions.
Question: I'm wondering whether, for any given function $f(x,y)$, all irreducible decompositions must have the same rank. I'm also wondering whether if you have two irreducible decompositions, the collected $g_i$ terms and the collected $h_i$ terms must be linearly dependent. (That is, if you have two decompositions $f(x,y) = \sum_{i=1}^n g_i(x)h_i(y) = \sum_{j=1}^m p_j(x) q_j(y)$, I wonder whether the sets $\{g_1, \ldots, g_n, p_1, \ldots, p_m\}$ and $\{h_1, \ldots, h_n, q_1, \ldots, q_m\}$ are necessarily linearly dependent sets.)
I'm not sure how to prove these or produce a counterexample. So far, I've started by, for example, taking two decompositions and subtracting them, looking to establish linear dependence that way.

As @Somos alludes to, a set of functions $f_1,\ldots, f_n$ is linearly independent if and only if you can find $x_1,\ldots,x_n$ such that the matrix $[f_i(x_j)]_{i,j}$ is invertible. Perhaps this fact can be useful. 
The conjecture holds for rank 1 functions at least: if two decompositions have rank 1, then the collected terms must be linearly dependent, as you can see by taking partial derivatives of both decompositions and concluding that the wronskians are singular.
 A: The answer to both questions is yes. Let's suppose that we have two decompositions
$$
f(x,y) = \sum_{i=1}^n g_i(x) h_i(y) = \sum_{j=1}^m p_j(x) q_j(y)
$$
with $m$ and $n$ both positive.
(1) To prove that all irreducible decompositions of $f$ have the same rank, it suffices to prove: if $n<m$, and if $\{q_1(y),\dots,q_m(y)\}$ is linearly independent, then $\{p_1(x),\dots,p_m(x)\}$ is linearly dependent. (Indeed this is slightly stronger—it shows that all irreducible decompositions have the same rank which is also the minimal rank among all reducible and irreducible decompositions.)
By assumption and the obversation of Somos/OP, we can choose $y_1,\dots,y_m$ so that the matrix $Q = [q_j(y_k)]_{1\le j,k\le m}$ is invertible. Note that if $P$ is the row vector $[p_i(x)]_{1\le i\le m}$, then $PQ = F$ where $F$ is the column vector $[f(x,y_k)]_{1\le k\le m}$. It follows that $P = FQ^{-1}$, which shows that each of $p_1(x),\dots,p_m(x)$ is a linear combination of the values $\{f(x,y_1),\dots,f(x,y_m)\}$. However, all these values are contained in the span of the vectors $\{g_1(x),\dots,g_n(x)\}$, which is a vector space of dimension at most $n$. Since $n<m$ it follows that $\{p_1(x),\dots,p_m(x)\}$ is linearly dependent.
(2) To show that $\{g_1, \ldots, g_n, p_1, \ldots, p_m\}$ is necessarily linearly dependent if both decompositions are irreducible, we start by noting that $\sum_{i=1}^n g_i(x) h_i(y) - \sum_{j=1}^m p_j(x) q_j(y)$ is identically zero. If $\{g_1, \ldots, g_n, p_1, \ldots, p_m\}$ were linearly independent, then the argument above would show that each $h_i(y)$ and each $q_j(y)$ is also identically zero, which contradicts irreducibility.
