Matrix inner product derivation/matrix derivation including Hadamard root/matrix elements-wise square root/matrix element-wise square root derivation/F norm derivation

There are relatively few matrix derivation cases including Hadamard root, this case is for reference only:


1 topic

Given X ∈ R n \mathbf{X} \in \mathbb{R}^{n}XRn ,A ∈ R n × n \mathbf{A} \in \mathbb{R}^{n \times n}ARn × n ,f ( X ) = ∑ i = 1 n ∣ AX ∣ i 2 + δ 2 f(\mathbf{X})=\sum_{i=\mathbf{1}}^{n} \sqrt{| \mathbf{A} \mathbf{X}|_{i}^{2}+\delta^{2}}f(X)=i=1nAXi2+d2 . where ( ⋅ ) \sqrt{(\cdot)}() Represents the Hadamard root (elements-wise square root), that is, the square root of the matrix elements item by item. Find f ′ ( X ) f^{\prime}(\mathbf{X})f(X),即 ∂ f ∂ X \frac{\partial f}{\partial \mathbf{X}} Xf

2 solve

2.1 First use the Hadamard product to solve the square root

v = ∣ AX ∣ 2 + δ 2 1 \mathbf{v}=\sqrt{|\mathbf{A} \mathbf{X}|^{2}+\delta^{2}\mathbf{1}}v=AX2+d21

∴ v ⊙ v = ∣ AX ∣ 2 + δ 2 1 = AX ⊙ AX + δ 2 1 \begin{aligned} \therefore \quad \mathbf{v} \odot \mathbf{v} &=|\mathbf{A}; \mathbf{X}|^{2}+\delta^{2} \mathbf{1}\\ &=\mathbf{A} \mathbf{X} \odot \mathbf{A} \mathbf{X}+\ delta^{2}\mathbf{1}\end{aligned}vv=AX2+d21=AXAX+d21

According to the property of differential Hadamard product : d ( X ⊙ Y ) = X ⊙ d Y + d X ⊙ Y d(\mathbf{X} \odot \mathbf{Y})=\mathbf{X} \odot d \mathbf{ Y}+d \mathbf{X} \odot \mathbf{Y}d(XY)=XdY+dXY有:
d ( v ⊙ v ) = v ⊙ dv + dv ⊙ v = v ⊙ dv + v ⊙ dv = 2 v ⊙ dv \begin{aligned} d(\mathbf{v} \odot \mathbf{v}) &=\mathbf{v} \odot d \mathbf{v}+d \mathbf{v} \odot \mathbf{v} \\ &=\mathbf{v} \odot d \mathbf{v}+\mathbf{ v} \odot d \mathbf{v} \\ &= 2\mathbf{v} \odot d \mathbf{v} \end{aligned}d(vv)=vdv+dvv=vdv+vdv=2 vdv

即:
2 v ⊙ dv = d ( AX ⊙ AX + δ 2 1 ) = d ( AX ⊙ AX ) + d ( δ 2 1 ) = 2 AX ⊙ d ( AX ) = 2 AX ⊙ ( ( d A ) X + A d X ) = 2 AX ⊙ A d X \begin{aligned} 2 \mathbf{v} \odot d \mathbf{v} &=d\left(\mathbf{A} \mathbf{X} \odot \mathbf {A} \mathbf{X}+\delta^{2} \mathbf{1}\right) \\ &=d(\mathbf{A} \mathbf{X} \odot \mathbf{A} \mathbf{X })+d(\delta^{2}\mathbf{1})\\&=2\mathbf{A}\mathbf{X}\odot d(\mathbf{A}\mathbf{X})\\& =2 \mathbf{A} \mathbf{X} \odot((d \mathbf{A}) \mathbf{X}+\mathbf{A} d \mathbf{X}) \\ &=2 \mathbf{A } \mathbf{X} \odot \mathbf{A} d \mathbf{X} \end{aligned}2 vdv=d(AXAX+d21)=d(AXAX)+d ( d21)=2AXd(AX)=2AX( ( d A ) X+AdX)=2AXAdX

∴ dv = AX ⊙ A d X ⊘ v \therefore \quad d \mathbf{v}=\mathbf{A} \mathbf{X} \odot \mathbf{A} d \mathbf{X} \oslash \mathbf{v } }dv=AXAdXv
where⊘ \oslash is Hadamard division / elements-wise division, that is, matrix item-wise division, and⊙ \odot have similar properties. Or letp ⊙ v = 1 \mathbf{p} \odot \mathbf{v} = \mathbf{1}pv=1,即p \mathbf{p}p isv \mathbf{v}vBy Hadamard inverse / element-wise inverse, equationdv = AX ⊙ A d X ⊙ pd \mathbf{v}=\mathbf{A} \mathbf{X} \odot \mathbf{A} d \mathbf{X} \odot\mathbf{p}dv=AXAdXp.

2.2 Using the properties of Frobenius inner product (matrix inner product) and trace, the solution can be obtained

Give the Frobenius inner product : A : B = tr ⁡ ( ATB ) \mathbf{A}:\mathbf{B} = \operatorname{tr}(\mathbf{A}^{T}\mathbf{B})A:B=tr(AT B), can get:
f = 1 : v ∴ df = d ( 1 : v ) = d 1 : v + 1 : dv ( value : ∇ ( A : B ) = ∇ A : B + A : ∇ B ) = 1 : dv = : ( AX ⊙ A d X ⊘ v ) = 1 : ( AX ⊘ v ⊙ A d X ) ( Find : X ⊙ Y = Y ⊘ v ) = ( 1 ⊙ ( AX ⊘ v ) ) : ( A d X ) ( Form : C : ( A ⊙ B ) = ( C ⊙ A ) : B ) = ( AX ⊘ v ) : ( A d X ) = AT ( AX ⊘ v ) : d X ( Form : CA : B = A : CTB = C : BAT = tr ⁡ ( ( AT ( AX ⊘ v ) ) T d X ) ( free and independent ) 即 ∂ f ∂ X = AT ( AX ⊘ v ) ( Definite : df = tr ⁡ ( ( ∂ f ∂ X ) T d X ) ) \begin{aligned} f &=\mathbf{1}: \mathbf{v} \\ \therefore \quad df &= d(\mathbf{1}: \ mathbf{v}) \\ &= d\mathbf{1}:\mathbf{v} + \mathbf{1}:d\mathbf{v}\quad (definition: \nabla(\mathbf{A}: \mathbf {B})=\nabla \mathbf{A}: \mathbf{B}+\mathbf{A}: \nabla \mathbf{B}) \\ &=\mathbf{1}: d \mathbf{v}\ \&=\mathbf{1}:(\mathbf{A} \mathbf{X} \odot \mathbf{A} d \mathbf{X} \oslash \mathbf{v}) \\ &=\mathbf{1}:(\mathbf{A} \mathbf {X} \oslash \mathbf{v} \odot \mathbf{A} d \mathbf{X} ) \quad ( property: \mathbf{X} \odot \mathbf{Y} = \mathbf{Y} \odot \ mathbf{X}) \\ &=(\mathbf{1}\odot(\mathbf{A} \mathbf{X} \oslash \mathbf{v})) : (\mathbf{A} d \mathbf{X} ) \quad ( property: \mathbf{C}:(\mathbf{A} \odot \mathbf{B}) = (\mathbf{C} \odot \mathbf{A}):\mathbf{B})\\ &=(\mathbf{A} \mathbf{X} \oslash \mathbf{v}):(\mathbf{A} d \mathbf{X}) \\ &=\mathbf{A}^{T}(\ mathbf{A} \mathbf{X} \oslash \mathbf{v}): d \mathbf{X} \quad ( property: \mathbf{C} \mathbf{A} : \mathbf{B} = \mathbf{A } : \mathbf{C}^T\mathbf{B} = \mathbf{C} :\mathbf{B} \mathbf{A}^T \\ &=\operatorname{tr}((\mathbf{A}^T (\mathbf{A} \mathbf{X} \oslash \mathbf{v} )) ^T d \mathbf{X})\quad (free fraction)\\ in \quad \frac{\partial f}{\partial \mathbf{X}} &=\mathbf{A}^{T}( \mathbf{A} \mathbf{X} \oslash \mathbf{v}) \quad (definition: df=\operatorname{tr}\left(\left(\frac{\partial f}{\partial \mathbf{X }}\right)^{T}d\mathbf{X}\right))\end{aligned}fdfRight nowXf=1:v=d(1:v)=d 1:v+1:dv( nature:(A:B)=A:B+A:B)=1:dv=1:(AXAdXv)=1:(AXvAdX)( nature:XY=YX)=(1(AXv)):(AdX)( nature:C:(AB)=(CA):B)=(AXv):(AdX)=AT(AXv):dX( nature:CA:B=A:CTB=C:BAT=tr((AT(AXv))T dX)( Definition of matrix inner product )=AT(AXv)( properties : d f=tr((Xf)TdX))
If the Hadamard inverse defined above is used, the result can also be expressed as:
∂ f ∂ X = AT ( AX ⊙ p ) \frac{\partial f}{\partial \mathbf{X}} =\mathbf{A}^ {T}(\mathbf{A} \mathbf{X} \odot \mathbf{p})Xf=AT(AXp)

Summary:
First use the Hadamard product to solve the square root, and then use the correlation properties to get dvd\mathbf{v}d v , and finally use the properties of matrix inner product and trace to get the solution.

Reference link:

Guess you like

Origin blog.csdn.net/lyh458/article/details/121868963