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}X∈Rn ,A ∈ R n × n \mathbf{A} \in \mathbb{R}^{n \times n}A∈Rn × 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=1n∣AX∣i2+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}} ∂X∂f。
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=∣AX∣2+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}∴v⊙v=∣AX∣2+d21=AX⊙AX+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(X⊙Y)=X⊙dY+dX⊙Y有:
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(v⊙v)=v⊙dv+dv⊙v=v⊙dv+v⊙dv=2 v⊙dv
即:
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 v⊙dv=d(AX⊙AX+d21)=d(AX⊙AX)+d ( d21)=2AX⊙d(AX)=2AX⊙( ( d A ) X+AdX)=2AX⊙AdX
∴ 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=AX⊙AdX⊘v
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}p⊙v=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=AX⊙AdX⊙p.
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}f∴dfRight now∂X∂f=1:v=d(1:v)=d 1:v+1:dv( nature:∇(A:B)=∇A:B+A:∇B)=1:dv=1:(AX⊙AdX⊘v)=1:(AX⊘v⊙AdX)( nature:X⊙Y=Y⊙X)=(1⊙(AX⊘v)):(AdX)( nature:C:(A⊙B)=(C⊙A):B)=(AX⊘v):(AdX)=AT(AX⊘v):dX( nature:CA:B=A:CTB=C:BAT=tr((AT(AX⊘v))T dX)( Definition of matrix inner product )=AT(AX⊘v)( properties : d f=tr((∂X∂f)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})∂X∂f=AT(AX⊙p)
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: