Homework 2
2. Probability Potpourri
Q1
Concisely, Σ=E[(Z−μ)(Z−μ)⊤], where μ is the mean value of the
(column) vector Z. Show that the covariance matrix is always positive semidefinite (PSD).
proof: 只需证明:对于任何非零向量 v,vTΣv≥0 恒成立。
vTΣv=vTE[(Z−μ)(Z−μ)T]v=E[vT(Z−μ)(Z−μ)Tv]
令 Y=Z−μ:
LHS=E[vTYYTv]=E[(vTY)(YTv)]
由于 v 为 n×1 的列向量,vT 为 1×n 的行向量。而 Y 为 n×1 的列向量,两者相乘得到 1×1 的标量。YTv 亦然 (事实上,YTv=(vTY)T,而标量的转置就是它本身)。因此:
(vTY)(YTv)=(vTY)2
因此,E[(vTY)(YTv)] 就转变成一个非负随机变量的期望。这个期望显然是非负的。
Q4
Consider a discrete random variable X that takes on a value from a finite sample space Z. For a value x∈Z, let p(x) be the probability that X takes the value x. The entropy of X is
H(X)=−x∈Z∑p(x)lnp(x).
(i) First, let’s consider a random variable from a Bernoulli distribution, which has only two possible states. Let X∼Bernoulli(p), p∈(0,1). Show that H(X) is concave in p. (That is, −H(X) is a convex function of p.)
proof: 伯努利分布的熵函数如下:
H(p)=−[pln(p)+(1−p)ln(1−p)]
其二阶导数:
H′′(p)=−(p1+1−p1)<0
因此伯努利分布的熵函数为凹函数。
Consider a sample space Z with n states, a discrete distribution over those states, and a random variable X drawn from that distribution. Show that among all possible PMFs over n states, the entropy H(X) is maximized by the uniform distribution. What is H(X) for that distribution?
Answer: 首先根据题意,我们建立如下的优化问题:
- 已知:包含 n 个状态的样本空间,概率质量分布为 p=(p1,p2,…,pn)
- 优化问题:
H(p)subject to=−i∑pilnpii∑pi=1,pi≥0∀i
我们引入一个参照分布 q=(q1,q2,...,qn),其中 ∀i,qi=n1。我们使用KL散度衡量任意一个分布 p 和我们的猜测分布 q 之间的差距。
KL散度具有如下性质:两个分布的差距永远是非负的。只有当两个分布完全相同时,差距才是0。
根据KL散度计算公式,有:
DKL(p∥q)=i∑pilnqipi≥0
而:
i∑pilnqipi=i∑pilnpi−i∑pilnqi=−H(p)+lnn
因此:
H(p)≤ln(n)
而当 ∀i,pi=qi=n1 时,H(p)=lnn。因此证毕。
线性代数部分我不会做…就跳过了
4 Matrix/Vector Calculus
Q1
我们分别求 g(A)=sin(A112+e(A11+A22)) 和 h(A)=xTAy 的梯度。
对 g(A) 有:
∂A11∂g=cos(A112+eA11+A22)∂A11∂(A112+eA11+A22)=cos(A112+eA11+A22)(2A11+eA11+A22∂A11∂(A11+A22))=cos(A112+eA11+A22)(2A11+eA11+A22)
∂A12∂g=0
∂A21∂g=0
∂A22∂g=cos(A112+eA11+A22)∂A22∂(A112+eA11+A22)=cos(A112+eA11+A22)(eA11+A22∂A22∂(A11+A22))=cos(A112+eA11+A22)eA11+A22
因此 g(x) 的梯度矩阵为:
∇Ag(A)=[cos(A112+eA11+A22)(2A11+eA11+A22)00cos(A112+eA11+A22)eA11+A22]
对 h(A),xTAy 是一个标量,我们先将其展开:
xAyxTAyh(A)=[x1x2],y=[y1y2]=[A11y1+A12y2A21y1+A22y2]=x1(A11y1+A12y2)+x2(A21y1+A22y2)=x1y1A11+x1y2A12+x2y1A21+x2y2A22
对展开的结果的每个参数求偏导:
∂A11∂h∂A12∂h∂A21∂h∂A22∂h=x1y1=x1y2=x2y1=x2y2
因此 h(x) 的梯度矩阵为:
∇Ah(A)=[x1y1x2y1x1y2x2y2]=[x1x2][y1y2]=xyT
这是一个非常常用的矩阵求导结论:∇A(xTAy)=xyT。
于是:
∇Af(A)=∇Ag(A)+∇Ah(A)=[cos(A112+eA11+A22)(2A11+eA11+A22)+x1y1x2y1x1y2cos(A112+eA11+A22)eA11+A22+x2y2]