Does $f(a,b)$ being directly proportional to $a$ and $b$ separately imply that $f(a,b)$ is directly proportional to $ab?$ For example, in physics, if $$\text{F} \propto m_1m_2$$ and $$\text{F} \propto \frac{1}{r^2},$$ then $$\text{F} \propto (m_1m_2)\left(\frac{1}{r^2}\right)= \frac{m_1m_2}{r^2}.$$
This property (combining proportionality) intuitively makes sense, but I have never seen it formally written in a textbook.
Could someone please rigorously prove this property (and fully specify its conditions?), or give a counterexample?
P.S. I know that this question has been answered, including here, but I do not understand the explanations: e.g., I don’t understand how $k=f(C)$ or $k′=g(B).$
 A: Let $F$ be a function depending on two variables $x$ and $y$. Assume that $F$ is proportional to $x$. This means that the value of $\frac{F(x,y)}{x}$ only depends on the value of $y$. Thus for non-zero $x$ and $y$, $\frac{F(x,y)}{x}=\frac{F(1,y)}{1}$, meaning
$$\frac{F(x,y)}{x}=F(1,y).$$
Further, assume that $F$ is proportional to $y$. Analogously, we acquire for non-zero $x$ and $y$,
$$\frac{F(x,y)}{y}=F(x,1).$$
To prove that $F$ is proportional to $xy$, it suffices to show that $\frac{F(x,y)}{xy}$ is constant. Indeed, combining both formulas above, we obtain
$$\frac{F(x,y)}{xy}=\frac{F(1,y)}{y}=F(1,1).$$
A: Theorem
Let $y=f(a,b)$ on $\mathbb R^2$ so that variables $a$ and $b$ are independent of each other.
Then $$y\propto ab$$ iff $$\:y\propto a\quad\text {and}\quad y\propto b.$$
Proof

*

*Suppose that $\,y\propto ab,$ i.e., $y$ is jointly proportional to $a$ and $b.$ Then there exists $k\in\mathbb R{\setminus}\{0\}$ such that $$∀(a,b){\in}\mathbb R^2\quad y=k\big(ab\big).$$
So, there exists $k\in\mathbb R{\setminus}\{0\}$ such that  \begin{align}&∀(a,b){\in}\mathbb R^2\quad y=\big(kb\big)a\\\text{and}\quad&∀(a,b){\in}\mathbb R^2\quad y=\big(ka\big)b.\end{align}
So, there exist non-identically-zero functions $g$ and $h$ on $\mathbb R$ such that \begin{align}&∀(a,b){\in}\mathbb R^2\quad y=\big(g(b)\big)a\\\text{and}\quad&∀(a,b){\in}\mathbb R^2\quad y=\big(h(a)\big)b;\end{align} that is, $$y\propto a\quad\text {and}\quad y\propto b.$$


*Suppose that $\,y\propto a\:$ and $\:y\propto b.$ Then there exist functions $g$ and $h$ on $\mathbb R$ such that  \begin{align}∀(a,b){\in}\mathbb R^2\quad&\big(g(b)\big)a=y=\big(h(a)\big)b \\\text{and}\quad&g(b)\not\equiv0 \\\text{and}\quad&h(a)\not\equiv0.\end{align}
Putting $(1,0)$ shows that $g(0)=0.$ Thus, from the second conjunct, $g(t)\ne0$ for some nonzero $t.$ Putting $(a,t):$ \begin{align}∀a{\in}\mathbb R\quad&\big(g(t)\big)a=\big(h(a)\big)t\\∀a{\in}\mathbb R\quad&h(a)=\frac at g(t);\\
∀(a,b){\in}\mathbb R^2\quad&y=\frac {g(t)}tab.\end{align}
Hence, there exists $k\in\mathbb R{\setminus}\{0\}$ such that $$∀(a,b){\in}\mathbb R^2\quad y=k\big(ab\big);$$ that is, $$y\propto ab.$$

In the following examples, there's an additional dependency between variables $x$ and $y$, so the theorem's condition is not satisfied.

*

*Let $z=y$ and $y=2x.$
Then $z=2x.$
Now, there exists no real $k$ such that for each $x,\;2x=k(2x^2).$
So, there exists no real $k$ such that for each $x$ and $y,\;z=k(xy).$
Thus, $z$ is directly proportional to each of $x$ and $y,$ but not
to $xy.$


*Let $z=3xy$ and $y=2x.$
Then $z=6x^2.$
Now, there exists no real $k$ such that for each $x,\;6x^2=kx.$
So, there exists no real $k$ such that for each $x,\;z=kx.$
Thus, $z$ is directly proportional to $xy,$ but not to $x.$
A: The condition $f(a,b) \propto a$ means that, for every $b$, there is a constant $k_b$ such that $f(a,b)=a\cdot k_b$. Thus, $k_b= f(1,b)$ and then $f(a,b)= a \cdot f(1,b)$.
Similarly, $f(a,b)=b\cdot f(a,1)$.
You can substitute any of the two expressions in the other to find $f(a,b)=ab\cdot f(1,1)$.
