12.(12分)(2024·南京期末)在$\triangle ABC$中,$\angle BAC= 90^{\circ}$,$AB= AC$.
(1)如图①,D为BC边上一点,连接AD,以AD为边作$\triangle ADE$,$\angle DAE= 90^{\circ}$,$AD= AE$,连接EC.求证:$BD= CE$,$BD\perp CE$;
(2)如图②,D为$\triangle ABC$外一点.若$\angle ADC= 45^{\circ}$,$BD= 13$,$CD= 5$,求AD的长.

答案:(1) 证明: $\because ∠BAC = ∠DAE = 90^{\circ}$,
$\therefore ∠BAC - ∠DAC = ∠DAE - ∠DAC$,
即 $∠BAD = ∠CAE$,
在 $△ABD$ 和 $△ACE$ 中,$\left\{\begin{array}{l} AB = AC,\\ ∠BAD = ∠CAE,\\ AD = AE,\end{array}\right.$
$\therefore △ABD ≌ △ACE(SAS)$,$\therefore BD = CE$,$∠B = ∠ACE$,
$\because ∠BAC = 90^{\circ}$,$AB = AC$,
$\therefore ∠B = ∠BCA = 45^{\circ} = ∠ACE$,
$\therefore ∠BCE = ∠BCA + ∠ACE = 90^{\circ}$,即 $BD ⊥ CE$。
(2) 解: 如答图,过点 A 作 $AE ⊥ AD$,且 $AE = AD$,连接 DE,CE。
$\therefore △ADE$ 是等腰直角三角形。$\therefore ∠ADE = 45^{\circ}$。
$\because ∠ADC = 45^{\circ}$,$\therefore ∠CDE = 90^{\circ}$。同(1) 可证,$△ABD ≌ △ACE$,$\therefore BD = CE = 13$,
在 $Rt△CDE$ 中,$\because ∠CDE = 90^{\circ}$,$CD = 5$,$CE = 13$,
$\therefore DE^{2} + CD^{2} = CE^{2}$,即 $DE^{2} + 5^{2} = 13^{2}$,
$\therefore DE = 12$。
$\because ∠EAD = 90^{\circ}$,$\therefore AE^{2} + AD^{2} = DE^{2}$,
$\because AE = AD$,$\therefore 2AD^{2} = 144$,$\therefore AD = 6\sqrt{2}$。