{"id":4978,"date":"2019-07-08T12:00:09","date_gmt":"2019-07-08T17:00:09","guid":{"rendered":"https:\/\/blogs.mathworks.com\/cleve\/?p=4978"},"modified":"2019-11-09T00:08:55","modified_gmt":"2019-11-09T05:08:55","slug":"the-worlds-simplest-impossible-problem","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/cleve\/2019\/07\/08\/the-worlds-simplest-impossible-problem\/","title":{"rendered":"The World&#8217;s Simplest Impossible Problem"},"content":{"rendered":"\r\n<div class=\"content\"><!--introduction--><!--\/introduction--><p>(This is a reprint of the second ever Cleve's Corner from the <a href=\"https:\/\/www.mathworks.com\/content\/dam\/mathworks\/tag-team\/Objects\/t\/72935_92036v00Cleve_Worlds_Simplest_Impossible_Problem_Win_1990.pdf\">Winter 1990 <i>MathWorks Newsletter<\/i><\/a>).<\/p><p>The other day at lunch with a couple of other MathWorks people, I posed the following problem:<\/p><p>&#8220;I'm thinking of two numbers.  Their average is 3. What are the numbers?&#8221;<\/p><p>Now stop a minute and, before you read any further, provide your own answer to my question.<\/p><p>Of course, my problem doesn't have a &#8220;right&#8221; answer.  The solution is not unique. The problem is &#8220;underdetermined&#8221; or &#8220;ill posed.&#8221;<\/p><p>Most of the people I was having lunch with wouldn't give me an answer. When I pressed them, one person finally said, &#8220;Both numbers could be 3.\" Another person said, &#8220;Yes, but one could be 6 and the other 0. That's what I hoped they would say. In some sense, these are both &#8220;nice&#8221; answers. Nobody said &#8220;23 and minus 17,&#8221; or &#8220;2.71828 and 3.28172.&#8221; Those would also have been been correct, but not as &#8220;nice.&#8221;<\/p><p>What does this have to do with MATLAB? Well, MATLAB doesn't balk at impossible problems. It will solve this one. And it does it without complaining like my buddies at lunch.<\/p><p>Naturally the problem is a matrix problem. It is a \"system\"<\/p><pre>A*x = b<\/pre><p>of one \"simultaneous\" linear equation in two unknowns.  The matrix is<\/p><pre>A = [1\/2 1\/2]<\/pre><p>and the right-hand side is<\/p><pre>b = 3<\/pre><p>MATLAB&#8217;s backslash solves such equations.  Typing<\/p><pre>x = A\\b<\/pre><p>tell's me<\/p><pre class=\"language-matlab\">x =\r\n     6\r\n     0\r\n<\/pre><p>The solution is a 2-by-1 matrix representation of one of the &#8220;nice&#8221; answers I expected.  The second half of the help entry for &#8220;\\&#8221; gives some indication of where this solution came from.<\/p><pre>If A is an m-by-n matrix with m &lt;\r\nor &gt; n and B is a column vector\r\nwith m components, or a matrix with\r\nseveral such columns, then X = A\\B\r\nis the solution in the least squares\r\nsense to the under- or overdetermined\r\nsystem of equations A*X = B.\r\nThe effective rank, k, of A is\r\ndetermined from the QR decomposition\r\nwith pivoting.  A solution X is\r\ncomputed which has at most k nonzero\r\ncomponents per column. If k &lt; n\r\nthis will usually not be the same\r\nsolution as PINV(A)*B.<\/pre><p>In our case, we have <tt>m = 1<\/tt> and <tt>n = 2<\/tt>. My matrix has full rank, but the most that can be is <tt>k = 1<\/tt>. So, we get a solution with at most one nonzero component. Even that isn't unique. There are exactly two solutions with one nonzero component, <tt>[6 0]&#8217;<\/tt> and <tt>[0 6]&#8217;<\/tt>. We get the one where the nonzero component has the smallest index.<\/p><p>What about my other &#8220;nice&#8221; solution? That comes from the pseudoinverse.<\/p><pre>x = pinv(A)*b<\/pre><p>produces<\/p><pre>x =\r\n    3.0000\r\n    3.0000<\/pre><p>(The fact that I got that I get 3.000 instead of the integer 3 without the trailing zeros indicates that there has been some roundoff error and I don't have the other &#8220;nice&#8221; solution exactly, but you can pursue that yourself if you really want to.)<\/p><p>Of all the possible solutions to <tt>A*x = b<\/tt>, this one, <tt>x = [3 3]&#8217;<\/tt>, is the &#8220;shortest.&#8221; It minimizes <tt>norm(x)<\/tt>. In fact <tt>x = A\\b<\/tt> has<\/p><pre>norm(x) = 6.0000<\/pre><p>while <tt>x = pinv(A)*b<\/tt> has<\/p><pre>norm(x) = 4.2426<\/pre><p>Now, finally, we have uniqueness.  Of all the possible solutions to <tt>A*x = b<\/tt>, the one that also minimizes <tt>norm(x)<\/tt> is unique.<\/p><p>So, MATLAB not only solves the problem, it gives us a choice between two different solutions, <tt>x = A\\b<\/tt> and <tt>x = pinv(A)*b<\/tt>.  I think the first solution, <tt>A\\b  = [6 0]'<\/tt>, is \"nice\", because it is \"simple\"; i.e, it has the fewest possible nonzero components.  I think the second solution, <tt>pinv(A)*b = [3 3]'<\/tt>, is \"nice\" because it is \"short\" and \"unique\".  None of the other possible solutions have such nice characteristics.<\/p><p>This problem, \"Given the average of two numbers, find the numbers,\" captures the essence of many ill-posed and underdetermined problems. Computer tomography, which is the life-saving business of generating images from X-ray, magnetic resonance, and other scanners, is really a grown-up version of this question.  Additional constraints, like minimum norm or fewest nonzero components, or \"good looking picture,\" have to be specified to make it a reasonable mathematical and computational task.<\/p><p>By the way, I first learned about this \"World's Simplest Impossible Problem\" from Don Morrison, who also started the University of New Mexico's Computer Science Department, invented the Fast Fourier Transform before Cooley and Tukey, and, years ago, got me to move to New Mexico. Thanks for all those things, Don.<\/p><p>I have to confess that I wrote this anecdote about posing a problem at a MathWorks lunch before it really happened.  The results of the actual experiment were even more interesting.  As I had expected, everybody did grumble and complain about my problem.  Then one person said \"9 and -3.\" She had obviously picked up on the idea.  Another person said \"3 and 1.\" Luckily, he is not responsible for any numeric portions of MATLAB. But three people said \"2 and 4.\"  That is certainly another \"nice\" answer, but the constraints it satisfies are more subtle.  They have something to do with requiring the solution to have integer components that are distinct, but near the average.  It's harder to state and compute in MATLAB without just giving the answer.<\/p><p>Okay, now I'm thinking off three numbers whose average is $\\pi$. What are those numbers?<\/p><script language=\"JavaScript\"> <!-- \r\n    function grabCode_d26518a51f87412dbf8aada164ea7105() {\r\n        \/\/ Remember the title so we can use it in the new page\r\n        title = document.title;\r\n\r\n        \/\/ Break up these strings so that their presence\r\n        \/\/ in the Javascript doesn't mess up the search for\r\n        \/\/ the MATLAB code.\r\n        t1='d26518a51f87412dbf8aada164ea7105 ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' d26518a51f87412dbf8aada164ea7105';\r\n    \r\n        b=document.getElementsByTagName('body')[0];\r\n        i1=b.innerHTML.indexOf(t1)+t1.length;\r\n        i2=b.innerHTML.indexOf(t2);\r\n \r\n        code_string = b.innerHTML.substring(i1, i2);\r\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\r\n\r\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \r\n        \/\/ in the XML parser.\r\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\r\n        \/\/ doesn't go ahead and substitute the less-than character. \r\n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\r\n\r\n        copyright = 'Copyright 2019 The MathWorks, Inc.';\r\n\r\n        w = window.open();\r\n        d = w.document;\r\n        d.write('<pre>\\n');\r\n        d.write(code_string);\r\n\r\n        \/\/ Add copyright line at the bottom if specified.\r\n        if (copyright.length > 0) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (copyright.length > 0) {\r\n                d.writeln('% _' + copyright + '_');\r\n            }\r\n        }\r\n\r\n        d.write('<\/pre>\\n');\r\n\r\n        d.title = title + ' (MATLAB code)';\r\n        d.close();\r\n    }   \r\n     --> <\/script><p style=\"text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray\"><br><a href=\"javascript:grabCode_d26518a51f87412dbf8aada164ea7105()\"><span style=\"font-size: x-small;        font-style: italic;\">Get \r\n      the MATLAB code <noscript>(requires JavaScript)<\/noscript><\/span><\/a><br><br>\r\n      Published with MATLAB&reg; R2018b<br><\/p><\/div><!--\r\nd26518a51f87412dbf8aada164ea7105 ##### SOURCE BEGIN #####\r\n%% The World's Simplest Impossible Problem\r\n%%\r\n% (This is a reprint of the second ever Cleve's Corner from the \r\n% <https:\/\/www.mathworks.com\/content\/dam\/mathworks\/tag-team\/Objects\/t\/72935_92036v00Cleve_Worlds_Simplest_Impossible_Problem_Win_1990.pdf\r\n% Winter 1990 _MathWorks Newsletter_>).\r\n\r\n%%\r\n% The other day at lunch with a couple of other MathWorks people, \r\n% I posed the following problem: \r\n%\r\n% \u00e2\u20ac\u0153I'm thinking of two numbers.  Their average is 3. What are the numbers?\u00e2\u20ac\ufffd\r\n%\r\n% Now stop a minute and, before you read any further, provide your\r\n% own answer to my question.\r\n%\r\n% Of course, my problem doesn't have a \u00e2\u20ac\u0153right\u00e2\u20ac\ufffd answer.  The solution is\r\n% not unique. The problem is \u00e2\u20ac\u0153underdetermined\u00e2\u20ac\ufffd or \u00e2\u20ac\u0153ill posed.\u00e2\u20ac\ufffd\r\n%\r\n% Most of the people I was having lunch with wouldn't give me an answer.\r\n% When I pressed them, one person finally said, \u00e2\u20ac\u0153Both numbers could be 3.\"\r\n% Another person said, \u00e2\u20ac\u0153Yes, but one could be 6 and the other 0.\r\n% That's what I hoped they would say. In some sense, these are both\r\n% \u00e2\u20ac\u0153nice\u00e2\u20ac\ufffd answers. Nobody said \u00e2\u20ac\u015323 and minus 17,\u00e2\u20ac\ufffd or \u00e2\u20ac\u01532.71828 and 3.28172.\u00e2\u20ac\ufffd\r\n% Those would also have been been correct, but not as \u00e2\u20ac\u0153nice.\u00e2\u20ac\ufffd\r\n\r\n%%\r\n% What does this have to do with MATLAB? Well, MATLAB doesn't balk at\r\n% impossible problems. It will solve this one. And it does it without\r\n% complaining like my buddies at lunch.\r\n%\r\n% Naturally the problem is a matrix problem. It is a \"system\"\r\n% \r\n%  A*x = b\r\n%\r\n% of one \"simultaneous\" linear equation in two unknowns.  The matrix is\r\n%\r\n%  A = [1\/2 1\/2]\r\n%\r\n% and the right-hand side is\r\n%\r\n%  b = 3\r\n\r\n%%\r\n% MATLAB\u00e2\u20ac&#x2122;s backslash solves such equations.  Typing\r\n%\r\n%  x = A\\b\r\n%\r\n% tell's me\r\n%\r\n%   x =\r\n%        6\r\n%        0\r\n%\r\n% The solution is a 2-by-1 matrix representation of one of the \u00e2\u20ac\u0153nice\u00e2\u20ac\ufffd\r\n% answers I expected.  The second half of the help entry for \u00e2\u20ac\u0153\\\u00e2\u20ac\ufffd gives\r\n% some indication of where this solution came from.\r\n%\r\n%  If A is an m-by-n matrix with m < \r\n%  or > n and B is a column vector\r\n%  with m components, or a matrix with\r\n%  several such columns, then X = A\\B\r\n%  is the solution in the least squares\r\n%  sense to the under- or overdetermined\r\n%  system of equations A*X = B.\r\n%  The effective rank, k, of A is\r\n%  determined from the QR decomposition \r\n%  with pivoting.  A solution X is \r\n%  computed which has at most k nonzero\r\n%  components per column. If k < n\r\n%  this will usually not be the same \r\n%  solution as PINV(A)*B.\r\n\r\n%%\r\n% In our case, we have |m = 1| and |n = 2|. My matrix has full rank,\r\n% but the most that can be is |k = 1|. So, we get a solution with at \r\n% most one nonzero component. Even that isn't unique. There are \r\n% exactly two solutions with one nonzero component, |[6 0]\u00e2\u20ac&#x2122;| and |[0 6]\u00e2\u20ac&#x2122;|.  \r\n% We get the one where the nonzero component has the smallest index. \r\n\r\n%%\r\n% What about my other \u00e2\u20ac\u0153nice\u00e2\u20ac\ufffd solution? That comes from the pseudoinverse.\r\n%\r\n%  x = pinv(A)*b\r\n%\r\n% produces\r\n%\r\n%  x = \r\n%      3.0000\r\n%      3.0000\r\n%\r\n% (The fact that I got that I get 3.000 instead of the integer 3 without \r\n% the trailing zeros indicates that there has been some roundoff error\r\n% and I don't have the other \u00e2\u20ac\u0153nice\u00e2\u20ac\ufffd solution exactly,\r\n% but you can pursue that yourself if you really want to.) \r\n\r\n%%\r\n% Of all the possible solutions to |A*x = b|, this one, |x = [3 3]\u00e2\u20ac&#x2122;|,\r\n% is the \u00e2\u20ac\u0153shortest.\u00e2\u20ac\ufffd\r\n% It minimizes |norm(x)|. In fact |x = A\\b| has\r\n%\r\n%  norm(x) = 6.0000\r\n%\r\n% while |x = pinv(A)*b| has \r\n%\r\n%  norm(x) = 4.2426\r\n%\r\n% Now, finally, we have uniqueness.  Of all the possible solutions to\r\n% |A*x = b|, the one that also minimizes |norm(x)| is unique.\r\n\r\n%%\r\n% So, MATLAB not only solves the problem, it gives us a choice between two\r\n% different solutions, |x = A\\b| and |x = pinv(A)*b|.  I think the first\r\n% solution, |A\\b  = [6 0]'|, is \"nice\", because it is \"simple\"; i.e,\r\n% it has the fewest possible nonzero components.  I think the second\r\n% solution, |pinv(A)*b = [3 3]'|, is \"nice\" because it is \"short\" and\r\n% \"unique\".  None of the other possible solutions have such nice\r\n% characteristics.\r\n\r\n%%\r\n% This problem, \"Given the average of two numbers, find the numbers,\"\r\n% captures the essence of many ill-posed and underdetermined problems.\r\n% Computer tomography, which is the life-saving business of generating\r\n% images from X-ray, magnetic resonance, and other scanners, is really\r\n% a grown-up version of this question.  Additional constraints, like\r\n% minimum norm or fewest nonzero components, or \"good looking picture,\"\r\n% have to be specified to make it a reasonable mathematical and\r\n% computational task.\r\n\r\n%%\r\n% By the way, I first learned about this \"World's Simplest Impossible\r\n% Problem\" from Don Morrison, who also started the University of New\r\n% Mexico's Computer Science Department, invented the Fast Fourier Transform\r\n% before Cooley and Tukey, and, years ago, got me to move to New Mexico.\r\n% Thanks for all those things, Don.\r\n\r\n%%\r\n% I have to confess that I wrote this anecdote about posing a problem at a\r\n% MathWorks lunch before it really happened.  The results of the actual\r\n% experiment were even more interesting.  As I had expected, everybody did\r\n% grumble and complain about my problem.  Then one person said \"9 and -3.\"\r\n% She had obviously picked up on the idea.  Another person said \"3 and 1.\"\r\n% Luckily, he is not responsible for any numeric portions of MATLAB.\r\n% But three people said \"2 and 4.\"  That is certainly another \"nice\"\r\n% answer, but the constraints it satisfies are more subtle.  They have\r\n% something to do with requiring the solution to have integer components\r\n% that are distinct, but near the average.  It's harder to state and\r\n% compute in MATLAB without just giving the answer.\r\n\r\n%%\r\n% Okay, now I'm thinking off three numbers whose average is $\\pi$.\r\n% What are those numbers?\r\n##### SOURCE END ##### d26518a51f87412dbf8aada164ea7105\r\n-->","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img src=\"https:\/\/blogs.mathworks.com\/cleve\/files\/snagit.png\" class=\"img-responsive attachment-post-thumbnail size-post-thumbnail wp-post-image\" alt=\"\" decoding=\"async\" loading=\"lazy\" \/><\/div><p>\r\n(This is a reprint of the second ever Cleve's Corner from the Winter 1990 MathWorks Newsletter).The other day at lunch with a couple of other MathWorks people, I posed the following... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/cleve\/2019\/07\/08\/the-worlds-simplest-impossible-problem\/\">read more >><\/a><\/p>","protected":false},"author":78,"featured_media":4990,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[5,4,6,8],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts\/4978"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/users\/78"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/comments?post=4978"}],"version-history":[{"count":9,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts\/4978\/revisions"}],"predecessor-version":[{"id":4984,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts\/4978\/revisions\/4984"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/media\/4990"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/media?parent=4978"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/categories?post=4978"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/tags?post=4978"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}