<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <title>ac | Yang X.Y.</title>
    <subtitle>A space for archiving and sharing organized materials on math, programming, design, languages...</subtitle>
    <link rel="self" type="application/atom+xml" href="https://yxy.ac/atom.xml"/>
    <link rel="alternate" type="text/html" href="https://yxy.ac"/>
    <generator uri="https://www.getzola.org/">Zola</generator>
    <updated>2026-08-01T00:00:00+00:00</updated>
    <id>https://yxy.ac/atom.xml</id>
    <entry xml:lang="en">
        <title>The Two Envelope Paradox, Explained and Extended</title>
        <published>2026-05-28T00:00:00+00:00</published>
        <updated>2026-05-28T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              yxy
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://yxy.ac/post/10010/the-two-envelope-paradox-explained-and-extended/"/>
        <id>https://yxy.ac/post/10010/the-two-envelope-paradox-explained-and-extended/</id>
        
        <content type="html" xml:base="https://yxy.ac/post/10010/the-two-envelope-paradox-explained-and-extended/">&lt;span id=&quot;continue-reading&quot;&gt;&lt;&#x2F;span&gt;&lt;h2 id=&quot;part-1&quot;&gt;Part 1&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;the-two-envelope-paradox&quot;&gt;The Two Envelope Paradox&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;You are shown with a choice between two indistinguishable envelopes and told that one contains twice as much money as the other. You arbitrarily select one and find it contains $X$. You are allowed to discard the one envelope opened and choose another envelope. Since your choice was arbitrary, the other envelope must contain either $2X$ or $X slash 2$, each with probability $1 slash 2$.
The expected value of switching is therefore $ 1&#x2F;2 times X&#x2F;2 + 1&#x2F;2 times 2X = 1.25 X &amp;gt; X $
So you ought to switch.
Yet the same reasoning applies symmetrically to whichever envelope you hold, compelling you to switch, even without opening any the envelope to inspect the amount $X$ then forth indefinitely—an obvious absurdity.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Besides, you may consider these reasonable implicit conditions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The amount in each envelope is a non-negative value, (i.e., $X &amp;gt;= 0$), which may be &quot;surrealistically&quot; large or small but can still fit into the envelopes anyway.&lt;&#x2F;li&gt;
&lt;li&gt;The mechanism determining the amounts is unknown (i.e., the distribution of $X$ is arbitrary), but it is independent of your choice.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;But where has this gone wrong? Let&#x27;s start by examining the following. That way, you should be able to understand the problem clearly.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;an-easy-choice&quot;&gt;An Easy Choice&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;You are shown with a choice between two indistinguishable envelopes and told that one contains $10$ dollars and the other contains $20$ dollars. You arbitrarily select one and find it contains $X in {10, 20}$. You are allowed to discard the opened envelope and choose another envelope.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;You always obtain the higher amount, $20$, by switching envelopes when you find the initially selected envelope contains $10$.&lt;&#x2F;p&gt;
&lt;p&gt;And in this case, if you arbitrarily select one envelope and always switch regardless of $X$, the expected value is&lt;br &#x2F;&gt;
$ 1&#x2F;2 times 20&#x2F;2 + 1&#x2F;2 times 2 times 10 = 15 $
This is the same as the expected value of the envelope you initially selected at random, $15$, obviously. Hence, logically, you are indifferent to switching or not!&lt;&#x2F;p&gt;
&lt;h3 id=&quot;another-easy-choice&quot;&gt;Another Easy Choice&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;You are shown with a choice between two colored envelopes and told that the red one contains twice as much money as the other blue one. You are allowed to discard the one envelope opened and choose another envelope.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;You always obtain the higher amount by choosing the red envelope, though you don&#x27;t know how much money is in the red envelope.&lt;&#x2F;p&gt;
&lt;p&gt;Think about this scenario: you close your eyes and randomly select one envelope, then switch to the other envelope. What is the expected value of the amount in the envelope you finally select? Denoting the amount in the blue envelope as $X_&quot;blue&quot;$ and the amount in the red envelope as $X_&quot;red&quot; = 2 X_&quot;blue&quot;$, the expected value is
$ 1&#x2F;2 times X_&quot;blue&quot; times 2 + 1&#x2F;2 times X_&quot;red&quot; &#x2F; 2 = 1&#x2F;2 times X_&quot;blue&quot; times 2 + 1&#x2F;2 times X_&quot;blue&quot; = 1.5 X_&quot;blue&quot; $
It is reasonably the same as the expected value of the envelope you initially selected at random
$ 1&#x2F;2 times X_&quot;blue&quot; + 1&#x2F;2 times X_&quot;red&quot; = 1&#x2F;2 times X_&quot;blue&quot; + 1&#x2F;2 times X_&quot;blue&quot; times 2 = 1.5 X_&quot;blue&quot; $
By now, the distinction between the $X$ in the two envelope problem and the $X_&quot;blue&quot;$ in this problem tells where the misunderstanding firstly lies in the two envelope paradox.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;magic-money&quot;&gt;Magic Money&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;You are shown with a choice between two indistinguishable envelopes and told that the amount in each envelope is in the form of $2^n, n in ZZ$, and one contains twice as much money as the other. You arbitrarily select one and find it contains $X in {dots, 1&#x2F;8, 1&#x2F;4, 1&#x2F;2, 1, 2, 4, 8, 16, dots}$. You are allowed to discard the one envelope opened and choose another envelope.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;This problem is beginning to develop some flavor.&lt;&#x2F;p&gt;
&lt;p&gt;If someone tries to treat $X$ as a uniform distribution, or &quot;every amount is equally likely&quot;, then
the expected value of the envelope you initially selected is
$ lim_(m -&amp;gt; infinity) 1&#x2F;m sum_(n=1)^m 2^(-n) + lim_(m -&amp;gt; infinity) 1&#x2F;m sum_(n=0)^m 2^n = 0 + lim_(m -&amp;gt; infinity) 1&#x2F;m sum_(n=0)^m 2^n = infinity $
which diverges to infinity. But without magic turning the pattern of our world, you can&#x27;t expect to get an infinite amount of money!
In fact, the definition of a probability measure&lt;sup class=&quot;footnote-reference&quot;&gt;&lt;a href=&quot;#1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; does not allow a uniform distribution on countably infinite sets or infinite intervals.&lt;&#x2F;p&gt;
&lt;p&gt;On the other hand, if you arbitrarily select one envelope and always switch regardless of $X$, following the same &quot;uniform distribution&quot; form, the expected value is&lt;br &#x2F;&gt;

&lt;pre class=&quot;typst&quot;&gt;&lt;code&gt;$ &amp;amp;lim_(m -&amp;gt; infinity) 1&amp;#x2F;m sum_(n=1)^m (1&amp;#x2F;2 times 2^(-n) &amp;#x2F; 2 + 1&amp;#x2F;2 times 2^(-n) times 2) 
+ lim_(m -&amp;gt; infinity) 1&amp;#x2F;m sum_(n=0)^m (1&amp;#x2F;2 times 2^n &amp;#x2F; 2 + 1&amp;#x2F;2 times 2^n times 2) \
&amp;amp;= 0 + lim_(m -&amp;gt; infinity) 1&amp;#x2F;m sum_(n=0)^m (2^(n-2) + 2^n) \
&amp;amp;= infinity $&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;

Though the comparison of the two infinite expected values is confusing, it seems to be also logically indifferent to switching or not.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;the-two-envelopes-empty&quot;&gt;The Two Envelopes Empty&lt;&#x2F;h3&gt;
&lt;p&gt;Now return to the original two envelope problem statement.&lt;&#x2F;p&gt;
&lt;p&gt;The amount of money in the envelopes should be treated as a random variable.
Set that the smaller amount, denoted by $X_1$, is a continuous random variable with probability density $f(x)$. Also assume that the other envelope has a $1 slash 2$ probability of containing $X_1 slash 2$ and a $1 slash 2$ probability of containing $2 X_1$.&lt;&#x2F;p&gt;
&lt;p&gt;Then, the probability density must satisfy
$f(x) = f(2x)$.&lt;&#x2F;p&gt;
&lt;p&gt;Suppose
$PP(1 &amp;lt; X_1 &amp;lt; 2) = P$,
which follows that
$PP(2 &amp;lt; X_1 &amp;lt; 4) = 2P$.&lt;&#x2F;p&gt;
&lt;p&gt;In general,
$PP(2^k &amp;lt; X_1 &amp;lt; 2^(k+1)) = 2^k P$.
If $P &amp;gt; 0$, then for sufficiently large $k$, this probability exceeds $1$, which is impossible. Hence,
$P = 0$,
so for every $k$,
$PP(2^k &amp;lt; X_1 &amp;lt; 2^(k+1)) = 0$.&lt;&#x2F;p&gt;
&lt;p&gt;Considering
$PP(1&#x2F;(2^m) &amp;lt; X_1 &amp;lt; 2^m)$,
the additivity of probabilities gives this probability zero for every $m$. Letting $m -&amp;gt; infinity$ finally yields
$PP(X_1 &amp;gt; 0) = 0$.&lt;&#x2F;p&gt;
&lt;p&gt;Thus, under this assumption, the only possible conclusion is that neither envelope contains money.
This aligns with that the two envelope paradox is a result of an improper prior distribution, or &quot;a probability measure does not allow a uniform distribution on countably infinite sets or infinite intervals&quot; as noted earlier.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;part-2&quot;&gt;Part 2&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;the-two-normal-envelopes&quot;&gt;The Two Normal Envelopes&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;You are given two indistinguishable envelopes. One envelope contains an amount $M$, and the other contains twice that amount, $2M$. The amount $M$ may be positive or negative, where a negative amount represents debt. (For convenience, this is not limited to positive numbers here.) Suppose that $M$ is a normally distributed random variable with unknown mean $mu$ and variance $sigma^2$
$ M tilde.op N(mu, sigma^2) $
You randomly choose one envelope, open it, and find that it contains $X$.
You may either keep this envelope or discard it and switch to the other envelope.
The normal density is
$ f(t) = 1&#x2F;(sigma sqrt(2 pi)) e^(-((t-mu)^2)&#x2F;(2 sigma^2)) $&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;After observing $X$, there are two possible cases.
First, the opened envelope may contain the base amount
$X = M$,
The density contribution of this case is
$1&#x2F;2 f(X)$.
Or, the opened envelope may contain twice the base amount
$X = 2M$,
then
$M = X slash 2$.
Here the density of $X$ in this case is not simply $f(X&#x2F;2)$. A change of variables is required, with the Jacobian factor,
$ f_M (X&#x2F;2) times abs( dif&#x2F;(dif X) (X&#x2F;2) ) = f(X&#x2F;2) times 1&#x2F;2 $
Its total density contribution is
$1&#x2F;2 times 1&#x2F;2 f(X&#x2F;2) = 1&#x2F;4 f(X&#x2F;2)$.&lt;&#x2F;p&gt;
&lt;p&gt;Therefore, the posterior probability that the opened envelope contains the base amount is
$ P(X = M | X) = frac(1&#x2F;2 f(X), 1&#x2F;2 f(X) + 1&#x2F;4 f(X&#x2F;2)) = frac(2 f(X), 2 f(X) + f(X&#x2F;2)) $&lt;&#x2F;p&gt;
&lt;p&gt;The posterior probability that the opened envelope contains twice the base amount is
$ P(X = 2M | X) = frac(1&#x2F;4 f(X&#x2F;2), 1&#x2F;2 f(X) + 1&#x2F;4 f(X&#x2F;2)) = frac(f(X&#x2F;2), 2 f(X) + f(X&#x2F;2)) $
The expected value of switching is

&lt;pre class=&quot;typst&quot;&gt;&lt;code&gt;$ E(&amp;quot;switch&amp;quot; | X) &amp;amp;= frac(2 f(X), 2 f(X) + f(X&amp;#x2F;2)) times 2X + frac(f(X&amp;#x2F;2), 2 f(X) + f(X&amp;#x2F;2)) times X&amp;#x2F;2 \
&amp;amp;= frac(4X f(X) + X&amp;#x2F;2 f(X&amp;#x2F;2), 2 f(X) + f(X&amp;#x2F;2)) \
&amp;amp;= frac(4X e^(-((X-mu)^2)&amp;#x2F;(2 sigma^2)) + X&amp;#x2F;2 e^(-((X&amp;#x2F;2-mu)^2)&amp;#x2F;(2 sigma^2)), 2 e^(-((X-mu)^2)&amp;#x2F;(2 sigma^2)) + e^(-((X&amp;#x2F;2-mu)^2)&amp;#x2F;(2 sigma^2))) $&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;

If, in a generous scenario, the parameters $mu$ and $sigma$ are given, then the expected value of switching can be compared with $E(&quot;keep&quot; | X) = X$ to exactly determine whether to switch or not by the observed value of $X$.&lt;&#x2F;p&gt;
&lt;div class=&quot;footnote-definition&quot; id=&quot;1&quot;&gt;&lt;sup class=&quot;footnote-definition-label&quot;&gt;1&lt;&#x2F;sup&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Probability_measure&quot;&gt;Probability measure - Wikipedia&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;div&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>My PC Environment Setup Manual - Windows</title>
        <published>2025-08-19T00:00:00+00:00</published>
        <updated>2026-02-05T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              yxy
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://yxy.ac/post/10009/my-pc-environment-setup-manual-windows/"/>
        <id>https://yxy.ac/post/10009/my-pc-environment-setup-manual-windows/</id>
        
        <summary type="html">&lt;p&gt;To maintain a consistent PC environment on &lt;em&gt;Windows 10&lt;&#x2F;em&gt;, here is my installation and configuration manual, covering key points from OS setup to the final running steady state.
The principle is minimalism, and I rely on package managers to keep most of the applications streamlined.&lt;&#x2F;p&gt;</summary>
        
    </entry>
    <entry xml:lang="en">
        <title>A List of Confusable Words</title>
        <published>2025-02-18T00:00:00+00:00</published>
        <updated>2025-02-18T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              yxy
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://yxy.ac/post/10008/a-list-of-confusable-words/"/>
        <id>https://yxy.ac/post/10008/a-list-of-confusable-words/</id>
        
        <summary type="html">&lt;p&gt;This list features approximately 1,300 GRE-level words, collated into 500 sets of confusable or semantically related terms. Each word is accompanied by a link to its Wiktionary entry.&lt;&#x2F;p&gt;</summary>
        
    </entry>
    <entry xml:lang="en">
        <title>Μαθαίνοντας Ελληνικά - Βασικά</title>
        <published>2024-11-02T00:00:00+00:00</published>
        <updated>2025-02-09T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              yxy
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://yxy.ac/post/10006/mathainontas-ellenika-basika/"/>
        <id>https://yxy.ac/post/10006/mathainontas-ellenika-basika/</id>
        
        <summary type="html">&lt;p&gt;&lt;em&gt;Incomplete&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Greek (Modern Greek: Ελληνικά; Ancient Greek: Ἑλληνική) is an Indo-European language, constituting an independent Hellenic branch within the Indo-European language family. It has the longest documented history of any Indo-European language, spanning at least 3,400 years of written records. &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Greek_language&quot;&gt;&lt;em&gt;Greek language - Wikipedia&lt;&#x2F;em&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;The title, &lt;em&gt;Μαθαίνοντας Ελληνικά - Βασικά&lt;&#x2F;em&gt;, means &lt;em&gt;Learning Greek - Basics&lt;&#x2F;em&gt;. Here, &quot;Greek&quot; refers specifically to modern Greek, as distinct from Classical, Koine, or Medieval Greek.&lt;&#x2F;p&gt;</summary>
        
    </entry>
    <entry xml:lang="en">
        <title>PDE Introductory Exercises and Solutions</title>
        <published>2024-09-22T00:00:00+00:00</published>
        <updated>2024-09-22T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              yxy
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://yxy.ac/post/10005/pde-introductory-exercises-and-solutions/"/>
        <id>https://yxy.ac/post/10005/pde-introductory-exercises-and-solutions/</id>
        
        <summary type="html">&lt;p&gt;These exercises, provided in 5 PDF files each corresponding to a chapter, are taken from &lt;em&gt;Lecture Notes on Partial Differential Equations&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;</summary>
        
    </entry>
    <entry xml:lang="en">
        <title>Roam from LaTeX to Typst</title>
        <published>2024-09-01T00:00:00+00:00</published>
        <updated>2024-09-01T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              yxy
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://yxy.ac/post/10004/roam-from-latex-to-typst/"/>
        <id>https://yxy.ac/post/10004/roam-from-latex-to-typst/</id>
        
        <summary type="html">&lt;p&gt;Over the past 40 years, TeX (and LaTeX) has accumulated a vast ecosystem of programs and documentation, solidifying its position as the &lt;em&gt;de facto&lt;&#x2F;em&gt; standard for typesetting in academia and publishing.&lt;&#x2F;p&gt;</summary>
        
    </entry>
    <entry xml:lang="en">
        <title>Test Page</title>
        <published>2001-01-01T00:00:00+00:00</published>
        <updated>2026-08-01T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              yxy
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://yxy.ac/post/10000/test-page/"/>
        <id>https://yxy.ac/post/10000/test-page/</id>
        
        <summary type="html">&lt;p&gt;This page tests the rendering of Markdown elements in posts.&lt;&#x2F;p&gt;</summary>
        
    </entry>
</feed>
