\documentclass[全部作业]{subfiles}
\setlength{\textheight}{300em}
% \PassOptionsToPackage{papersize={170mm, 1000em}}{geometry}
% \usepackage[textheight=1em]{geometry}
\setlength{\paperheight}{300em}

\begin{document}
\chapter{单元作业5}
\begin{enumerate}
    \questionandanswer[]{设随机变量$X$与$Y$满足$EX=EY=0$, $\operatorname{Var}X=\operatorname{Var}Y=1$, $\operatorname{Cov}(X,Y)=\rho $，证明$E\max(X^{2},Y^{2})\leqslant 1+\sqrt{1-\rho ^{2}}$}{
        \begin{proof}

            因为$\operatorname{Cov}(X,Y)=EXY-EXEY=\rho $，而$EX=EY=0$，所以$EXY=\rho $。\\
            而$\operatorname{Var}X=EX^{2}-(EX)^{2}=EX^{2}=1$，$\operatorname{Var}Y=EY^{2}-(EY)^{2}=EY^{2}=1$。

            根据$\max(a,b)=\frac{\left\vert a+b \right\vert +\left\vert a-b \right\vert }{2}$和期望的线性性质，
            \begin{equation}\label{eq:1}\tag{1}
                E \max(X^{2},Y^{2})=E \frac{\left\vert X^{2}+Y^{2} \right\vert +\left\vert X^{2}-Y^{2} \right\vert }{2}=\frac{1}{2}E\left\vert X^{2}+Y^{2} \right\vert +\frac{1}{2}E\left\vert X^{2}-Y^{2} \right\vert 
            \end{equation}

            其中，$E\left\vert X^{2}+Y^{2} \right\vert =E(X^{2}+Y^{2})=EX^{2}+EY^{2}=2$，
            $E\left\vert X^{2}-Y^{2} \right\vert =E\left\vert X+Y \right\vert \left\vert X-Y \right\vert $。
            根据Cauchy-Schwarz不等式，$\left(E\left\vert X+Y \right\vert \left\vert X-Y \right\vert\right) ^{2}\leqslant E\left\vert X+Y \right\vert ^{2}E\left\vert X-Y \right\vert ^{2}$。

            其中$E\left\vert X+Y \right\vert ^{2}=E(X^{2}+2XY+Y^{2})=EX^{2}+2EXY+EY^{2}=2+2\rho $，\\
            $E\left\vert X-Y \right\vert ^{2}=E(X^{2}-2XY+Y^{2})=EX^{2}-2XY+EY^{2}=2-2\rho $。

            因此$\left( E\left\vert X+Y \right\vert \left\vert X-Y \right\vert  \right) ^{2}\leqslant (2+2\rho )(2-2\rho )=4(1-\rho ^{2})$，两边同取根号可得
            $$E\left\vert X^{2}-Y^{2} \right\vert =E\left\vert X+Y \right\vert \left\vert X-Y \right\vert \leqslant 2\sqrt{1-\rho ^{2}}$$

            再代入回 \eqref{eq:1} ，即可得到
            $$
            E\max(X^{2},Y^{2})\leqslant \frac{1}{2}\times 2+\frac{1}{2}\times 2\sqrt{1-\rho ^{2}}=1+\sqrt{1-\rho ^{2}}
            $$

        \end{proof}
    }
    \questionandanswer[]{设随机变量$(X,Y)$服从均匀分布$U(D)$，其中$D=\{ (x,y)\ |\ x^{2}+y^{2}\leqslant 1 \}$，求$X$与$Y$的协方差。}{
        \begin{proof}[解]
            
            设$p(x,y)$表示随机变量$(X,Y)$的联合概率密度函数，则可以得到
            $$
            p(x,y)=\begin{cases}
            \frac{1}{\pi },\quad & (x,y)\in D \\
            0,\quad & (x,y)\not \in D \\
            \end{cases}
            $$
            $$
            EX=\iint xp(x,y)\mathrm{d}x\mathrm{d}y=\iint_{D}x \cdot \frac{1}{\pi }\mathrm{d}x\mathrm{d}y\xlongequal{\textit{对称性}} 0
            $$
            $$
            EY=\iint yp(x,y)\mathrm{d}x\mathrm{d}y=\iint_{D}y \cdot \frac{1}{\pi }\mathrm{d}x\mathrm{d}y\xlongequal{\textit{对称性}} 0
            $$
            $$
            EXY=\iint xyp(x,y)\mathrm{d}x\mathrm{d}y=\iint_{D}xy \cdot \frac{1}{\pi }\mathrm{d}x\mathrm{d}y\xlongequal{\textit{对称性}} 0
            $$
            所以$X$与$Y$的协方差为
            $$
            \operatorname{Cov}(X,Y)=EXY-EXEY=0
            $$

        \end{proof}
    }
    \questionandanswer[]{设随机变量$(X,Y)$服从均匀分布$U(D)$，其中$D=\{ (x,y)\ |\ 0<x<y<1 \}$，求相关系数$\operatorname{Corr}(X,Y)$。}{
        \begin{proof}[解]
            
            设$p(x,y)$表示随机变量$(X,Y)$的联合概率密度函数，则可以得到
            $$
            p(x,y)=\begin{cases}
            2,\quad & 0<x<y<1 \\
            0,\quad & \textit{其他} \\
            \end{cases}
            $$
            $$
            EX=\iint xp(x,y)\mathrm{d}x\mathrm{d}y=\iint_{D}x\cdot 2\mathrm{d}x\mathrm{d}y=\int_0^{1}\int_0^{y}2x\mathrm{d}x\mathrm{d}y = \frac{1}{3}
            $$
            $$
            EY=\iint yp(x,y)\mathrm{d}x\mathrm{d}y=\iint_{D}y\cdot 2\mathrm{d}x\mathrm{d}y=\int_0^{1}\int_0^{y}2y\mathrm{d}x\mathrm{d}y = \frac{2}{3}
            $$
            $$
            EXY=\iint xyp(x,y)\mathrm{d}x\mathrm{d}y=\iint_{D}xy\cdot 2\mathrm{d}x\mathrm{d}y=\int_0^{1}\int_0^{y}2xy\mathrm{d}x\mathrm{d}y = \frac{1}{4}
            $$
            所以$X$与$Y$的协方差为
            $$
            \operatorname{Cov}(X,Y)=EXY-EXEY=\frac{1}{4}-\frac{1}{3}\times \frac{2}{3} = \frac{1}{36}
            $$
            还需要计算
            $$
            EX^{2}=\iint x^{2}p(x,y)\mathrm{d}x\mathrm{d}y=\iint_{D} x^{2}\cdot 2\mathrm{d}x\mathrm{d}y=\int_0^{1}\int_0^{y}2x^{2}\mathrm{d}x\mathrm{d}y = \frac{1}{6}
            $$
            $$
            EY^{2}=\iint y^{2}p(x,y)\mathrm{d}x\mathrm{d}y=\iint_{D}y^{2}\cdot 2\mathrm{d}x\mathrm{d}y=\int_0^{1}\int_0^{y}2y^{2}\mathrm{d}x\mathrm{d}y = \frac{1}{2}
            $$
            所以$X$与$Y$的相关系数为
            $$
            \begin{aligned}
                \operatorname{Corr}(X,Y)&=\frac{\operatorname{Cov}(X,Y)}{\sqrt{\operatorname{Var}X\cdot \operatorname{Var}Y}}=\frac{\operatorname{Cov}(X,Y)}{\sqrt{(EX^{2}-(EX)^{2})\cdot (EY^{2}-(EY)^{2})}}\\
                &=\frac{\dfrac{1}{36}}{\sqrt{\left( \dfrac{1}{6}-\left( \dfrac{1}{3} \right) ^{2} \right) \left( \dfrac{1}{2}-\left( \dfrac{2}{3} \right) ^{2} \right) }} = \dfrac{1}{2}\\
            \end{aligned}
            $$

        \end{proof}
    }
    \questionandanswer[]{设随机变量$(X,Y)$的联合概率密度函数为$p(x,y)=\begin{cases}
    e^{-y},\quad & 0<x<y \\
    0,\quad & \text{otherwise} \\
    \end{cases}$, 设$y>0$，求在$Y=y$时$X$的条件概率密度函数$p_{X|Y}(x|y)$，条件数学期望$E(X|Y=y)$。进一步地，利用重期望公式求$EX$。}{
        \begin{proof}[解]
            
            先计算边际概率密度函数
            $$
            p_{Y}(y)=\int_{-\infty}^{+\infty} p(x,y) \mathrm{d}x=\begin{cases}
            \int_{0}^{y} e^{-y} \mathrm{d}x,\quad & y>0 \\
            0,\quad & y\leqslant 0 \\
            \end{cases}=\begin{cases}
            ye^{-y},\quad & y>0 \\
            0,\quad & y\leqslant 0 \\
            \end{cases}
            $$
            之后计算条件概率密度函数
            $$
            p_{X|Y}(x|y)=\frac{p(x,y)}{p_{Y}(y)}=\begin{cases}
            \frac{1}{y},\quad & 0<x<y \\
            0,\quad & 0< y\leqslant x \textit{或}y>0,x\leqslant 0 \\
            \end{cases}
            $$
            根据数学期望的定义，
            $$
            E(X|Y=y)=\int_{-\infty}^{+\infty} x p_{X|Y}(x|y) \mathrm{d}x  = \int_{0}^{y} x\cdot \frac{1}{y} \mathrm{d}x  = \frac{y}{2}
            $$
            再利用重期望公式，
            $$
            EX=\int_{-\infty}^{+\infty} E(X|Y=y)p_{Y}(y) \mathrm{d}y=\int_{0}^{+\infty} \frac{y}{2}\cdot ye^{-y} \mathrm{d}y = 1
            $$

        \end{proof}
    }
    \questionandanswer[]{设$X$服从指数分布$\operatorname{Exp}(\lambda )$，求$Y=[X]$的分布。（这里符号$[a]$表示不超过$a$的最大整数。}{
        \begin{proof}[解]
            
            由于$Y=[X]$是离散型分布，所以求出$Y$的分布列即可
            $$
            p_i=\int_{i}^{i+1} \lambda e^{-\lambda x} \mathrm{d}x = (e^{\lambda} - 1) e^{- \lambda (i + 1)}
            $$

        \end{proof}
    }
    \questionandanswer[]{设随机变量$X$服从标准正态分布$N(0,1)$, $a>0$，记$Y=\begin{cases}
    X,\quad & \left\vert X \right\vert <a \\
    -X,\quad & \left\vert X \right\vert \geqslant a \\
    \end{cases}$，求随机变量$Y$的分布。}{
        \begin{proof}[解]
            
            因为$X\sim N(0,1)$，所以$-X\sim N(0,1)$，所以随机变量$Y$服从标准正态分布$N(0,1)$，即
            $$
            Y\sim N(0,1)
            $$

        \end{proof}
    }
    \questionandanswer[]{设二维随机变量$(X,Y)$的联合概率密度函数为 $$
        p(x,y)=\begin{cases}
        2,\quad & \textit{若}0<x<y<1; \\
        0,\quad & \textit{其他.} \\
        \end{cases}
        $$ 求
        \begin{enumerate}
            \item 随机变量$T=X-Y$的概率密度函数$p_{T}(t)$；
            \item 概率$P(Y-X\leqslant \frac{1}{2})$。
        \end{enumerate}
    }{
        \begin{proof}[解]
            
            \begin{enumerate}
                \item 
                根据连续情形的卷积公式，
                $$
                p_{T}(t)=\int_{-\infty}^{+\infty} p(x,x-t) \mathrm{d}x=\begin{cases}
                    \int_{0}^{t+1} 2 \mathrm{d}x,\quad & -1<t<0 \\
                    0,\quad & t\leqslant -1 \textit{或}t\geqslant 0 \\
                \end{cases}=\begin{cases}
                    2t+2,\quad & -1<t<0 \\
                    0,\quad & t\leqslant -1\textit{或}t\geqslant 0 \\
                \end{cases}
                $$

                \item 
                $$
                P(Y-X\leqslant \frac{1}{2})=P(X-Y\geqslant \frac{1}{2})=P(T\geqslant \frac{1}{2})=0
                $$
            \end{enumerate}

        \end{proof}
    }
    \questionandanswer[]{设$X$与$Y$独立同分布，共同分布为$N(0,1)$，求概率$P(\left\vert X+Y \right\vert \leqslant \left\vert X-Y \right\vert )$。}{
        \begin{proof}[解]
            
        %     根据正态分布的可加性，
        %     $$
        %     X+Y\sim N(0,2),\quad  X-Y\sim N(0,2)
        %     $$
        %     又因为
        %     $$
        % \begin{aligned}
        %     p_{(X+Y,X-Y)}(u,v) & = p_{(X,Y)} \left(\frac{u+v}{2},\frac{u-v}{2}\right) \left\vert J(u,v) \right\vert  \\
        %     & = p_{X} \left( \frac{u+v}{2} \right) p_{Y} \left( \frac{u-v}{2} \right) \begin{vmatrix}
        %     \frac{1}{2} & \frac{1}{2} \\
        %     \frac{1}{2} & -\frac{1}{2} \\
        %     \end{vmatrix}\\
        %     &=\frac{1}{2}\varphi\left(\frac{u+v}{2}\right)\varphi\left(\frac{u-v}{2}\right)\\
        %     &=\frac{1}{2}\cdot \frac{1}{\sqrt{2\pi }}e^{-\frac{1}{2} \left( \frac{u+v}{2} \right) ^{2}}\cdot \frac{1}{\sqrt{2\pi }}e^{-\frac{1}{2}\left( \frac{u-v}{2} \right) ^{2}} \\
        %     &=\frac{1}{\sqrt{2\pi }\cdot \sqrt{2}}\frac{1}{\sqrt{2\pi }\cdot \sqrt{2}}e^{-\frac{1}{8}\left( 2u^{2}+2v^{2} \right) } \\
        %     &=\frac{1}{\sqrt{2\pi }\sqrt{2}}e^{-\frac{u^{2}}{2\cdot 2}}\cdot \frac{1}{\sqrt{2\pi }\sqrt{2}}e^{-\frac{v^{2}}{2\cdot 2}} \\
        %     &=p_{X+Y}(u)\cdot p_{X-Y}(v) \\
        % \end{aligned}
        %     $$
        %     所以$X+Y$与$X-Y$相互独立，从而独立同分布，所以$\left\vert X+Y \right\vert $与$\left\vert X-Y \right\vert $也独立同分布，
        %     设他们的概率密度函数为$p_1(x)$，则根据独立同分布的可加性，$\left\vert X+Y \right\vert -\left\vert X-Y \right\vert $的概率密度函数可表示为$p_2(x)=p_1(x)+p_1(-x)$，是偶函数，于是
        %     $$
        %     P(\left\vert X+Y \right\vert \leqslant \left\vert X-Y \right\vert )=P(\left\vert X+Y \right\vert -\left\vert X-Y \right\vert \leqslant 0) = \frac{1}{2}
        %     $$

            $$
            \begin{aligned}
            P(\left\vert X+Y \right\vert \leqslant \left\vert X-Y \right\vert ) & = P\left( (X+Y)^{2}\leqslant (X-Y)^{2} \right)  \\
            & = P(X^{2}+2XY+Y^{2}\leqslant X^{2}-2XY+Y^{2})  \\
            & = P(4XY\leqslant 0)  \\
            & = P(XY\leqslant 0)  \\
            &=P(X\leqslant 0,Y>0) + P(X>0,Y\leqslant 0) \\
            &\xlongequal{X\textit{与}Y\textit{}独立}P(X\leqslant 0)P(Y>0)+P(X>0)P(Y\leqslant 0) \\
            &\xlongequal{X\sim N(0,1),Y\sim N(0,1)}\frac{1}{2}\times \frac{1}{2}+\frac{1}{2}\times \frac{1}{2} \\
            &=\frac{1}{2} \\
            \end{aligned}
            $$

        \end{proof}
    }
\end{enumerate}
\end{document}