An effective/mechanical way to check if a function is separable












1












$begingroup$


By $f(x, y)$ being separable, I mean $f(x,y)$ can be expressed as $f(x,y)=g(x)h(y)$ for some functions $g$ and $h$.



By an effective procedure, I mean mechanical/mindless/automatic way to do this, one that can be articulated as a short algorithm, that conclusively determines one way or the other after some time whether $f$ is separable or not.



Would the answer be different if we considered only analytic/named functions, versus if we considered all functions (including only numerically defined, unnamed ones)?










share|cite|improve this question









$endgroup$








  • 1




    $begingroup$
    What about checking if $f_x/f$ does not depend on $y$?
    $endgroup$
    – user
    5 hours ago










  • $begingroup$
    @user It might be necessary to know that $f$ is separable in order to know that $f_x/f$ does not depend on $y$. For example, one might need to know that $f(x,y)=cos(x+y)+cos(x-y)$ is separable to show that $f_x/f$ is a function of $x$ alone.
    $endgroup$
    – John Wayland Bales
    4 hours ago










  • $begingroup$
    I have tried to find $(f_x/f)_y$ for the function and obtained $0$ using only the fact that $sin^2 x + cos^2 x= sin^2 y + cos^2 y$. :) It may be of course only a coincidence.
    $endgroup$
    – user
    4 hours ago


















1












$begingroup$


By $f(x, y)$ being separable, I mean $f(x,y)$ can be expressed as $f(x,y)=g(x)h(y)$ for some functions $g$ and $h$.



By an effective procedure, I mean mechanical/mindless/automatic way to do this, one that can be articulated as a short algorithm, that conclusively determines one way or the other after some time whether $f$ is separable or not.



Would the answer be different if we considered only analytic/named functions, versus if we considered all functions (including only numerically defined, unnamed ones)?










share|cite|improve this question









$endgroup$








  • 1




    $begingroup$
    What about checking if $f_x/f$ does not depend on $y$?
    $endgroup$
    – user
    5 hours ago










  • $begingroup$
    @user It might be necessary to know that $f$ is separable in order to know that $f_x/f$ does not depend on $y$. For example, one might need to know that $f(x,y)=cos(x+y)+cos(x-y)$ is separable to show that $f_x/f$ is a function of $x$ alone.
    $endgroup$
    – John Wayland Bales
    4 hours ago










  • $begingroup$
    I have tried to find $(f_x/f)_y$ for the function and obtained $0$ using only the fact that $sin^2 x + cos^2 x= sin^2 y + cos^2 y$. :) It may be of course only a coincidence.
    $endgroup$
    – user
    4 hours ago
















1












1








1





$begingroup$


By $f(x, y)$ being separable, I mean $f(x,y)$ can be expressed as $f(x,y)=g(x)h(y)$ for some functions $g$ and $h$.



By an effective procedure, I mean mechanical/mindless/automatic way to do this, one that can be articulated as a short algorithm, that conclusively determines one way or the other after some time whether $f$ is separable or not.



Would the answer be different if we considered only analytic/named functions, versus if we considered all functions (including only numerically defined, unnamed ones)?










share|cite|improve this question









$endgroup$




By $f(x, y)$ being separable, I mean $f(x,y)$ can be expressed as $f(x,y)=g(x)h(y)$ for some functions $g$ and $h$.



By an effective procedure, I mean mechanical/mindless/automatic way to do this, one that can be articulated as a short algorithm, that conclusively determines one way or the other after some time whether $f$ is separable or not.



Would the answer be different if we considered only analytic/named functions, versus if we considered all functions (including only numerically defined, unnamed ones)?







functions algorithms






share|cite|improve this question













share|cite|improve this question











share|cite|improve this question




share|cite|improve this question










asked 5 hours ago









Yatharth AgarwalYatharth Agarwal

476417




476417








  • 1




    $begingroup$
    What about checking if $f_x/f$ does not depend on $y$?
    $endgroup$
    – user
    5 hours ago










  • $begingroup$
    @user It might be necessary to know that $f$ is separable in order to know that $f_x/f$ does not depend on $y$. For example, one might need to know that $f(x,y)=cos(x+y)+cos(x-y)$ is separable to show that $f_x/f$ is a function of $x$ alone.
    $endgroup$
    – John Wayland Bales
    4 hours ago










  • $begingroup$
    I have tried to find $(f_x/f)_y$ for the function and obtained $0$ using only the fact that $sin^2 x + cos^2 x= sin^2 y + cos^2 y$. :) It may be of course only a coincidence.
    $endgroup$
    – user
    4 hours ago
















  • 1




    $begingroup$
    What about checking if $f_x/f$ does not depend on $y$?
    $endgroup$
    – user
    5 hours ago










  • $begingroup$
    @user It might be necessary to know that $f$ is separable in order to know that $f_x/f$ does not depend on $y$. For example, one might need to know that $f(x,y)=cos(x+y)+cos(x-y)$ is separable to show that $f_x/f$ is a function of $x$ alone.
    $endgroup$
    – John Wayland Bales
    4 hours ago










  • $begingroup$
    I have tried to find $(f_x/f)_y$ for the function and obtained $0$ using only the fact that $sin^2 x + cos^2 x= sin^2 y + cos^2 y$. :) It may be of course only a coincidence.
    $endgroup$
    – user
    4 hours ago










1




1




$begingroup$
What about checking if $f_x/f$ does not depend on $y$?
$endgroup$
– user
5 hours ago




$begingroup$
What about checking if $f_x/f$ does not depend on $y$?
$endgroup$
– user
5 hours ago












$begingroup$
@user It might be necessary to know that $f$ is separable in order to know that $f_x/f$ does not depend on $y$. For example, one might need to know that $f(x,y)=cos(x+y)+cos(x-y)$ is separable to show that $f_x/f$ is a function of $x$ alone.
$endgroup$
– John Wayland Bales
4 hours ago




$begingroup$
@user It might be necessary to know that $f$ is separable in order to know that $f_x/f$ does not depend on $y$. For example, one might need to know that $f(x,y)=cos(x+y)+cos(x-y)$ is separable to show that $f_x/f$ is a function of $x$ alone.
$endgroup$
– John Wayland Bales
4 hours ago












$begingroup$
I have tried to find $(f_x/f)_y$ for the function and obtained $0$ using only the fact that $sin^2 x + cos^2 x= sin^2 y + cos^2 y$. :) It may be of course only a coincidence.
$endgroup$
– user
4 hours ago






$begingroup$
I have tried to find $(f_x/f)_y$ for the function and obtained $0$ using only the fact that $sin^2 x + cos^2 x= sin^2 y + cos^2 y$. :) It may be of course only a coincidence.
$endgroup$
– user
4 hours ago












2 Answers
2






active

oldest

votes


















3












$begingroup$

This problem is undecidable due to Rice's theorem.






share|cite|improve this answer









$endgroup$













  • $begingroup$
    That makes sense—I expected nothing less. Would you know what happens if we restrict $f$ to be an elementary function? Would there be a mechanical way then, in the same way there is for finding the derivative of a function?
    $endgroup$
    – Yatharth Agarwal
    4 hours ago












  • $begingroup$
    It is always possible with finite domains but it is fairly restrictive, you can also do it with polynomials. The problem is that you seem to think that having a function is equivalent to having a formula for a function written in terms of "elementary functions". The thing is that we know how to symbolically derive sum, product and composition, etc.. in terms of the function itself and its derivatives. So it just become symbolic manipulation. If you restrict yourself to formula of polynomial of simple univariate functions you could get something.
    $endgroup$
    – Paul Cottalorda
    2 hours ago










  • $begingroup$
    If you think about it, separability is pretty strong and does not hold well with sums, composition, etc.. So you might easily reject a lot of bad cases by symbolic analysis. But your set of function must be restricted a lot. I really want to empathize a thing here. As I previously said, having a function and having a comprehensive formula for a function are two extremely different thing. We can do a lot of things by playing around with symbolic representations of functions (this is mainly what we do in math) but inspecting the guts of a "random" function is almost impossible (algorithmically).
    $endgroup$
    – Paul Cottalorda
    2 hours ago



















1












$begingroup$

It depends very much how $f$ is expressed. If it's a black box - input arguments and get values, no idea how or even if there's any sort of formula - then no, there isn't any way to find that it's separable. What there is is a way to have a very good chance of quickly finding when it's not separable, and thus being able to hypothesize that a function likely is separable if we go long enough.



First, I'd like to change the terminology; instead of saying "separable", we ask whether the tensor rank of a function is $1$. What's the tensor rank? It's the smallest possible $n$ such that we can write $f(x,y)=sum_{i=1}^n g_i(x)h_i(y)$. For example, the tensor rank of $f(x,y)=0$ is $0$, the tensor rank of $f(x,y)=x^2sin(y)$ is $1$, the tensor rank of $f(x,y)=(x+y)^2=x^2+2xy+y^2$ is $3$, and the tensor rank of $f(x,y)=frac1{x+y+1}$ for $x,yge 0$ is $infty$.



What good does this do? Well, we can also talk about the tensor rank of a matrix; the tensor rank of $A$ is the smallest $n$ such that we can write $A=sum_{i=1}^n u_iv_i^T$, where the $u_i$ are column vectors and the $v_i^T$ are row vectors. If we build a matrix with $jk$ entry $f(x_j,y_k)$, the tensor rank of the function restricted to those points is the same as the tensor rank of the matrix - because we can exactly match a rank $1$ tensor $g_i(x)h_i(y)$ to a column by row product $G_i H_i^T$. The tensor rank of a general function (on a domain that's a Cartesian product) is equal to the supremum of the finite values we get from matrices of this form.



And then, there's a theorem: the tensor rank of a matrix is the same as the row rank, the column rank, or any other way we have to calculate it. There is just one rank for matrices, and this apparently new "tensor rank" is just another way to calculate rank.



So then, we have our method: Choose some random finite collection of values $x_j$ and $y_k$, find $f(x_j,y_k)$ for each $j$ and $k$, and look at whether the matrix $A$ of values $a_{jk}=f(x_j,y_k)$ has rank at most $1$. If it does, $f$ might have tensor rank $1$, and we can check again with more values. If it doesn't, $f$ has tensor rank greater than $1$ and we're done.



Why is it impossible to guarantee a decision? Consider $f(x,y)=begin{cases} 2&(x,y)=(a,b)\ 1&text{otherwise}end{cases}$ for $0le x,yle 1$ in $mathbb{R}^2$. If our lattice of points doesn't include the one bad point $(a,b)$, all of the values will be $1$ and the matrix will have rank $1$. If it does include the bad point, the matrix will have rank $2$. The function has tensor rank $2$ - but our probability of finding it with any finite collection of test points is zero.

This is a worst-case scenario. Most of the time, when a function has tensor rank greater than $1$, we'll find that out quickly. Still, in order to positively prove that the tensor rank is $1$ in a case in which the domain isn't finite, we'll need to apply some other method using more knowledge of the function.






share|cite|improve this answer









$endgroup$













  • $begingroup$
    This was super helpful! Thank you. I wonder if you have thoughts when we restrict $f$ to, say, elementary functions, in the same way we can mechanically compute the derivative?
    $endgroup$
    – Yatharth Agarwal
    4 hours ago











Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3079956%2fan-effective-mechanical-way-to-check-if-a-function-is-separable%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









3












$begingroup$

This problem is undecidable due to Rice's theorem.






share|cite|improve this answer









$endgroup$













  • $begingroup$
    That makes sense—I expected nothing less. Would you know what happens if we restrict $f$ to be an elementary function? Would there be a mechanical way then, in the same way there is for finding the derivative of a function?
    $endgroup$
    – Yatharth Agarwal
    4 hours ago












  • $begingroup$
    It is always possible with finite domains but it is fairly restrictive, you can also do it with polynomials. The problem is that you seem to think that having a function is equivalent to having a formula for a function written in terms of "elementary functions". The thing is that we know how to symbolically derive sum, product and composition, etc.. in terms of the function itself and its derivatives. So it just become symbolic manipulation. If you restrict yourself to formula of polynomial of simple univariate functions you could get something.
    $endgroup$
    – Paul Cottalorda
    2 hours ago










  • $begingroup$
    If you think about it, separability is pretty strong and does not hold well with sums, composition, etc.. So you might easily reject a lot of bad cases by symbolic analysis. But your set of function must be restricted a lot. I really want to empathize a thing here. As I previously said, having a function and having a comprehensive formula for a function are two extremely different thing. We can do a lot of things by playing around with symbolic representations of functions (this is mainly what we do in math) but inspecting the guts of a "random" function is almost impossible (algorithmically).
    $endgroup$
    – Paul Cottalorda
    2 hours ago
















3












$begingroup$

This problem is undecidable due to Rice's theorem.






share|cite|improve this answer









$endgroup$













  • $begingroup$
    That makes sense—I expected nothing less. Would you know what happens if we restrict $f$ to be an elementary function? Would there be a mechanical way then, in the same way there is for finding the derivative of a function?
    $endgroup$
    – Yatharth Agarwal
    4 hours ago












  • $begingroup$
    It is always possible with finite domains but it is fairly restrictive, you can also do it with polynomials. The problem is that you seem to think that having a function is equivalent to having a formula for a function written in terms of "elementary functions". The thing is that we know how to symbolically derive sum, product and composition, etc.. in terms of the function itself and its derivatives. So it just become symbolic manipulation. If you restrict yourself to formula of polynomial of simple univariate functions you could get something.
    $endgroup$
    – Paul Cottalorda
    2 hours ago










  • $begingroup$
    If you think about it, separability is pretty strong and does not hold well with sums, composition, etc.. So you might easily reject a lot of bad cases by symbolic analysis. But your set of function must be restricted a lot. I really want to empathize a thing here. As I previously said, having a function and having a comprehensive formula for a function are two extremely different thing. We can do a lot of things by playing around with symbolic representations of functions (this is mainly what we do in math) but inspecting the guts of a "random" function is almost impossible (algorithmically).
    $endgroup$
    – Paul Cottalorda
    2 hours ago














3












3








3





$begingroup$

This problem is undecidable due to Rice's theorem.






share|cite|improve this answer









$endgroup$



This problem is undecidable due to Rice's theorem.







share|cite|improve this answer












share|cite|improve this answer



share|cite|improve this answer










answered 4 hours ago









Paul CottalordaPaul Cottalorda

712




712












  • $begingroup$
    That makes sense—I expected nothing less. Would you know what happens if we restrict $f$ to be an elementary function? Would there be a mechanical way then, in the same way there is for finding the derivative of a function?
    $endgroup$
    – Yatharth Agarwal
    4 hours ago












  • $begingroup$
    It is always possible with finite domains but it is fairly restrictive, you can also do it with polynomials. The problem is that you seem to think that having a function is equivalent to having a formula for a function written in terms of "elementary functions". The thing is that we know how to symbolically derive sum, product and composition, etc.. in terms of the function itself and its derivatives. So it just become symbolic manipulation. If you restrict yourself to formula of polynomial of simple univariate functions you could get something.
    $endgroup$
    – Paul Cottalorda
    2 hours ago










  • $begingroup$
    If you think about it, separability is pretty strong and does not hold well with sums, composition, etc.. So you might easily reject a lot of bad cases by symbolic analysis. But your set of function must be restricted a lot. I really want to empathize a thing here. As I previously said, having a function and having a comprehensive formula for a function are two extremely different thing. We can do a lot of things by playing around with symbolic representations of functions (this is mainly what we do in math) but inspecting the guts of a "random" function is almost impossible (algorithmically).
    $endgroup$
    – Paul Cottalorda
    2 hours ago


















  • $begingroup$
    That makes sense—I expected nothing less. Would you know what happens if we restrict $f$ to be an elementary function? Would there be a mechanical way then, in the same way there is for finding the derivative of a function?
    $endgroup$
    – Yatharth Agarwal
    4 hours ago












  • $begingroup$
    It is always possible with finite domains but it is fairly restrictive, you can also do it with polynomials. The problem is that you seem to think that having a function is equivalent to having a formula for a function written in terms of "elementary functions". The thing is that we know how to symbolically derive sum, product and composition, etc.. in terms of the function itself and its derivatives. So it just become symbolic manipulation. If you restrict yourself to formula of polynomial of simple univariate functions you could get something.
    $endgroup$
    – Paul Cottalorda
    2 hours ago










  • $begingroup$
    If you think about it, separability is pretty strong and does not hold well with sums, composition, etc.. So you might easily reject a lot of bad cases by symbolic analysis. But your set of function must be restricted a lot. I really want to empathize a thing here. As I previously said, having a function and having a comprehensive formula for a function are two extremely different thing. We can do a lot of things by playing around with symbolic representations of functions (this is mainly what we do in math) but inspecting the guts of a "random" function is almost impossible (algorithmically).
    $endgroup$
    – Paul Cottalorda
    2 hours ago
















$begingroup$
That makes sense—I expected nothing less. Would you know what happens if we restrict $f$ to be an elementary function? Would there be a mechanical way then, in the same way there is for finding the derivative of a function?
$endgroup$
– Yatharth Agarwal
4 hours ago






$begingroup$
That makes sense—I expected nothing less. Would you know what happens if we restrict $f$ to be an elementary function? Would there be a mechanical way then, in the same way there is for finding the derivative of a function?
$endgroup$
– Yatharth Agarwal
4 hours ago














$begingroup$
It is always possible with finite domains but it is fairly restrictive, you can also do it with polynomials. The problem is that you seem to think that having a function is equivalent to having a formula for a function written in terms of "elementary functions". The thing is that we know how to symbolically derive sum, product and composition, etc.. in terms of the function itself and its derivatives. So it just become symbolic manipulation. If you restrict yourself to formula of polynomial of simple univariate functions you could get something.
$endgroup$
– Paul Cottalorda
2 hours ago




$begingroup$
It is always possible with finite domains but it is fairly restrictive, you can also do it with polynomials. The problem is that you seem to think that having a function is equivalent to having a formula for a function written in terms of "elementary functions". The thing is that we know how to symbolically derive sum, product and composition, etc.. in terms of the function itself and its derivatives. So it just become symbolic manipulation. If you restrict yourself to formula of polynomial of simple univariate functions you could get something.
$endgroup$
– Paul Cottalorda
2 hours ago












$begingroup$
If you think about it, separability is pretty strong and does not hold well with sums, composition, etc.. So you might easily reject a lot of bad cases by symbolic analysis. But your set of function must be restricted a lot. I really want to empathize a thing here. As I previously said, having a function and having a comprehensive formula for a function are two extremely different thing. We can do a lot of things by playing around with symbolic representations of functions (this is mainly what we do in math) but inspecting the guts of a "random" function is almost impossible (algorithmically).
$endgroup$
– Paul Cottalorda
2 hours ago




$begingroup$
If you think about it, separability is pretty strong and does not hold well with sums, composition, etc.. So you might easily reject a lot of bad cases by symbolic analysis. But your set of function must be restricted a lot. I really want to empathize a thing here. As I previously said, having a function and having a comprehensive formula for a function are two extremely different thing. We can do a lot of things by playing around with symbolic representations of functions (this is mainly what we do in math) but inspecting the guts of a "random" function is almost impossible (algorithmically).
$endgroup$
– Paul Cottalorda
2 hours ago











1












$begingroup$

It depends very much how $f$ is expressed. If it's a black box - input arguments and get values, no idea how or even if there's any sort of formula - then no, there isn't any way to find that it's separable. What there is is a way to have a very good chance of quickly finding when it's not separable, and thus being able to hypothesize that a function likely is separable if we go long enough.



First, I'd like to change the terminology; instead of saying "separable", we ask whether the tensor rank of a function is $1$. What's the tensor rank? It's the smallest possible $n$ such that we can write $f(x,y)=sum_{i=1}^n g_i(x)h_i(y)$. For example, the tensor rank of $f(x,y)=0$ is $0$, the tensor rank of $f(x,y)=x^2sin(y)$ is $1$, the tensor rank of $f(x,y)=(x+y)^2=x^2+2xy+y^2$ is $3$, and the tensor rank of $f(x,y)=frac1{x+y+1}$ for $x,yge 0$ is $infty$.



What good does this do? Well, we can also talk about the tensor rank of a matrix; the tensor rank of $A$ is the smallest $n$ such that we can write $A=sum_{i=1}^n u_iv_i^T$, where the $u_i$ are column vectors and the $v_i^T$ are row vectors. If we build a matrix with $jk$ entry $f(x_j,y_k)$, the tensor rank of the function restricted to those points is the same as the tensor rank of the matrix - because we can exactly match a rank $1$ tensor $g_i(x)h_i(y)$ to a column by row product $G_i H_i^T$. The tensor rank of a general function (on a domain that's a Cartesian product) is equal to the supremum of the finite values we get from matrices of this form.



And then, there's a theorem: the tensor rank of a matrix is the same as the row rank, the column rank, or any other way we have to calculate it. There is just one rank for matrices, and this apparently new "tensor rank" is just another way to calculate rank.



So then, we have our method: Choose some random finite collection of values $x_j$ and $y_k$, find $f(x_j,y_k)$ for each $j$ and $k$, and look at whether the matrix $A$ of values $a_{jk}=f(x_j,y_k)$ has rank at most $1$. If it does, $f$ might have tensor rank $1$, and we can check again with more values. If it doesn't, $f$ has tensor rank greater than $1$ and we're done.



Why is it impossible to guarantee a decision? Consider $f(x,y)=begin{cases} 2&(x,y)=(a,b)\ 1&text{otherwise}end{cases}$ for $0le x,yle 1$ in $mathbb{R}^2$. If our lattice of points doesn't include the one bad point $(a,b)$, all of the values will be $1$ and the matrix will have rank $1$. If it does include the bad point, the matrix will have rank $2$. The function has tensor rank $2$ - but our probability of finding it with any finite collection of test points is zero.

This is a worst-case scenario. Most of the time, when a function has tensor rank greater than $1$, we'll find that out quickly. Still, in order to positively prove that the tensor rank is $1$ in a case in which the domain isn't finite, we'll need to apply some other method using more knowledge of the function.






share|cite|improve this answer









$endgroup$













  • $begingroup$
    This was super helpful! Thank you. I wonder if you have thoughts when we restrict $f$ to, say, elementary functions, in the same way we can mechanically compute the derivative?
    $endgroup$
    – Yatharth Agarwal
    4 hours ago
















1












$begingroup$

It depends very much how $f$ is expressed. If it's a black box - input arguments and get values, no idea how or even if there's any sort of formula - then no, there isn't any way to find that it's separable. What there is is a way to have a very good chance of quickly finding when it's not separable, and thus being able to hypothesize that a function likely is separable if we go long enough.



First, I'd like to change the terminology; instead of saying "separable", we ask whether the tensor rank of a function is $1$. What's the tensor rank? It's the smallest possible $n$ such that we can write $f(x,y)=sum_{i=1}^n g_i(x)h_i(y)$. For example, the tensor rank of $f(x,y)=0$ is $0$, the tensor rank of $f(x,y)=x^2sin(y)$ is $1$, the tensor rank of $f(x,y)=(x+y)^2=x^2+2xy+y^2$ is $3$, and the tensor rank of $f(x,y)=frac1{x+y+1}$ for $x,yge 0$ is $infty$.



What good does this do? Well, we can also talk about the tensor rank of a matrix; the tensor rank of $A$ is the smallest $n$ such that we can write $A=sum_{i=1}^n u_iv_i^T$, where the $u_i$ are column vectors and the $v_i^T$ are row vectors. If we build a matrix with $jk$ entry $f(x_j,y_k)$, the tensor rank of the function restricted to those points is the same as the tensor rank of the matrix - because we can exactly match a rank $1$ tensor $g_i(x)h_i(y)$ to a column by row product $G_i H_i^T$. The tensor rank of a general function (on a domain that's a Cartesian product) is equal to the supremum of the finite values we get from matrices of this form.



And then, there's a theorem: the tensor rank of a matrix is the same as the row rank, the column rank, or any other way we have to calculate it. There is just one rank for matrices, and this apparently new "tensor rank" is just another way to calculate rank.



So then, we have our method: Choose some random finite collection of values $x_j$ and $y_k$, find $f(x_j,y_k)$ for each $j$ and $k$, and look at whether the matrix $A$ of values $a_{jk}=f(x_j,y_k)$ has rank at most $1$. If it does, $f$ might have tensor rank $1$, and we can check again with more values. If it doesn't, $f$ has tensor rank greater than $1$ and we're done.



Why is it impossible to guarantee a decision? Consider $f(x,y)=begin{cases} 2&(x,y)=(a,b)\ 1&text{otherwise}end{cases}$ for $0le x,yle 1$ in $mathbb{R}^2$. If our lattice of points doesn't include the one bad point $(a,b)$, all of the values will be $1$ and the matrix will have rank $1$. If it does include the bad point, the matrix will have rank $2$. The function has tensor rank $2$ - but our probability of finding it with any finite collection of test points is zero.

This is a worst-case scenario. Most of the time, when a function has tensor rank greater than $1$, we'll find that out quickly. Still, in order to positively prove that the tensor rank is $1$ in a case in which the domain isn't finite, we'll need to apply some other method using more knowledge of the function.






share|cite|improve this answer









$endgroup$













  • $begingroup$
    This was super helpful! Thank you. I wonder if you have thoughts when we restrict $f$ to, say, elementary functions, in the same way we can mechanically compute the derivative?
    $endgroup$
    – Yatharth Agarwal
    4 hours ago














1












1








1





$begingroup$

It depends very much how $f$ is expressed. If it's a black box - input arguments and get values, no idea how or even if there's any sort of formula - then no, there isn't any way to find that it's separable. What there is is a way to have a very good chance of quickly finding when it's not separable, and thus being able to hypothesize that a function likely is separable if we go long enough.



First, I'd like to change the terminology; instead of saying "separable", we ask whether the tensor rank of a function is $1$. What's the tensor rank? It's the smallest possible $n$ such that we can write $f(x,y)=sum_{i=1}^n g_i(x)h_i(y)$. For example, the tensor rank of $f(x,y)=0$ is $0$, the tensor rank of $f(x,y)=x^2sin(y)$ is $1$, the tensor rank of $f(x,y)=(x+y)^2=x^2+2xy+y^2$ is $3$, and the tensor rank of $f(x,y)=frac1{x+y+1}$ for $x,yge 0$ is $infty$.



What good does this do? Well, we can also talk about the tensor rank of a matrix; the tensor rank of $A$ is the smallest $n$ such that we can write $A=sum_{i=1}^n u_iv_i^T$, where the $u_i$ are column vectors and the $v_i^T$ are row vectors. If we build a matrix with $jk$ entry $f(x_j,y_k)$, the tensor rank of the function restricted to those points is the same as the tensor rank of the matrix - because we can exactly match a rank $1$ tensor $g_i(x)h_i(y)$ to a column by row product $G_i H_i^T$. The tensor rank of a general function (on a domain that's a Cartesian product) is equal to the supremum of the finite values we get from matrices of this form.



And then, there's a theorem: the tensor rank of a matrix is the same as the row rank, the column rank, or any other way we have to calculate it. There is just one rank for matrices, and this apparently new "tensor rank" is just another way to calculate rank.



So then, we have our method: Choose some random finite collection of values $x_j$ and $y_k$, find $f(x_j,y_k)$ for each $j$ and $k$, and look at whether the matrix $A$ of values $a_{jk}=f(x_j,y_k)$ has rank at most $1$. If it does, $f$ might have tensor rank $1$, and we can check again with more values. If it doesn't, $f$ has tensor rank greater than $1$ and we're done.



Why is it impossible to guarantee a decision? Consider $f(x,y)=begin{cases} 2&(x,y)=(a,b)\ 1&text{otherwise}end{cases}$ for $0le x,yle 1$ in $mathbb{R}^2$. If our lattice of points doesn't include the one bad point $(a,b)$, all of the values will be $1$ and the matrix will have rank $1$. If it does include the bad point, the matrix will have rank $2$. The function has tensor rank $2$ - but our probability of finding it with any finite collection of test points is zero.

This is a worst-case scenario. Most of the time, when a function has tensor rank greater than $1$, we'll find that out quickly. Still, in order to positively prove that the tensor rank is $1$ in a case in which the domain isn't finite, we'll need to apply some other method using more knowledge of the function.






share|cite|improve this answer









$endgroup$



It depends very much how $f$ is expressed. If it's a black box - input arguments and get values, no idea how or even if there's any sort of formula - then no, there isn't any way to find that it's separable. What there is is a way to have a very good chance of quickly finding when it's not separable, and thus being able to hypothesize that a function likely is separable if we go long enough.



First, I'd like to change the terminology; instead of saying "separable", we ask whether the tensor rank of a function is $1$. What's the tensor rank? It's the smallest possible $n$ such that we can write $f(x,y)=sum_{i=1}^n g_i(x)h_i(y)$. For example, the tensor rank of $f(x,y)=0$ is $0$, the tensor rank of $f(x,y)=x^2sin(y)$ is $1$, the tensor rank of $f(x,y)=(x+y)^2=x^2+2xy+y^2$ is $3$, and the tensor rank of $f(x,y)=frac1{x+y+1}$ for $x,yge 0$ is $infty$.



What good does this do? Well, we can also talk about the tensor rank of a matrix; the tensor rank of $A$ is the smallest $n$ such that we can write $A=sum_{i=1}^n u_iv_i^T$, where the $u_i$ are column vectors and the $v_i^T$ are row vectors. If we build a matrix with $jk$ entry $f(x_j,y_k)$, the tensor rank of the function restricted to those points is the same as the tensor rank of the matrix - because we can exactly match a rank $1$ tensor $g_i(x)h_i(y)$ to a column by row product $G_i H_i^T$. The tensor rank of a general function (on a domain that's a Cartesian product) is equal to the supremum of the finite values we get from matrices of this form.



And then, there's a theorem: the tensor rank of a matrix is the same as the row rank, the column rank, or any other way we have to calculate it. There is just one rank for matrices, and this apparently new "tensor rank" is just another way to calculate rank.



So then, we have our method: Choose some random finite collection of values $x_j$ and $y_k$, find $f(x_j,y_k)$ for each $j$ and $k$, and look at whether the matrix $A$ of values $a_{jk}=f(x_j,y_k)$ has rank at most $1$. If it does, $f$ might have tensor rank $1$, and we can check again with more values. If it doesn't, $f$ has tensor rank greater than $1$ and we're done.



Why is it impossible to guarantee a decision? Consider $f(x,y)=begin{cases} 2&(x,y)=(a,b)\ 1&text{otherwise}end{cases}$ for $0le x,yle 1$ in $mathbb{R}^2$. If our lattice of points doesn't include the one bad point $(a,b)$, all of the values will be $1$ and the matrix will have rank $1$. If it does include the bad point, the matrix will have rank $2$. The function has tensor rank $2$ - but our probability of finding it with any finite collection of test points is zero.

This is a worst-case scenario. Most of the time, when a function has tensor rank greater than $1$, we'll find that out quickly. Still, in order to positively prove that the tensor rank is $1$ in a case in which the domain isn't finite, we'll need to apply some other method using more knowledge of the function.







share|cite|improve this answer












share|cite|improve this answer



share|cite|improve this answer










answered 4 hours ago









jmerryjmerry

4,136514




4,136514












  • $begingroup$
    This was super helpful! Thank you. I wonder if you have thoughts when we restrict $f$ to, say, elementary functions, in the same way we can mechanically compute the derivative?
    $endgroup$
    – Yatharth Agarwal
    4 hours ago


















  • $begingroup$
    This was super helpful! Thank you. I wonder if you have thoughts when we restrict $f$ to, say, elementary functions, in the same way we can mechanically compute the derivative?
    $endgroup$
    – Yatharth Agarwal
    4 hours ago
















$begingroup$
This was super helpful! Thank you. I wonder if you have thoughts when we restrict $f$ to, say, elementary functions, in the same way we can mechanically compute the derivative?
$endgroup$
– Yatharth Agarwal
4 hours ago




$begingroup$
This was super helpful! Thank you. I wonder if you have thoughts when we restrict $f$ to, say, elementary functions, in the same way we can mechanically compute the derivative?
$endgroup$
– Yatharth Agarwal
4 hours ago


















draft saved

draft discarded




















































Thanks for contributing an answer to Mathematics Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3079956%2fan-effective-mechanical-way-to-check-if-a-function-is-separable%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

Calculate evaluation metrics using cross_val_predict sklearn

Insert data from modal to MySQL (multiple modal on website)