In $\triangle A B C, \tan \angle B C A=1$ and $\tan \angle B A C=\frac{1}{7}$. The perimeter of $\triangle A B C$ is $24+18 \sqrt{2}$. The altitude from $B$ to $A C$ has length $h$ and intersects $A C$ at $D$. What is the value of $h$ ?

![](https://cdn.mathpix.com/cropped/2024_04_17_587bc2a8915214d42f9eg-2.jpg?height=247&width=680&top_left_y=961&top_left_x=777)
We are given that $\tan \angle B A C=\frac{1}{7}$, but $\angle B A C=\angle B A D$ and $\triangle B A D$ has a right angle at $D$, so $\tan \angle B A D=\frac{B D}{A D}=\frac{1}{7}$. Since $B D=h, A D=7 \cdot B D=7 h$.

Using that $\tan \angle B C D=\tan \angle B C A=1$, we get $C D=h$ by similar reasoning. Therefore, $A C=A D+C D=7 h+h=8 h$.

![](https://cdn.mathpix.com/cropped/2024_04_17_c3c8a275c8ba62c19ff3g-03.jpg?height=247&width=677&top_left_y=1725&top_left_x=781)

Applying the Pythagorean theorem to $\triangle A B D$, we get that $A B=\sqrt{(7 h)^{2}+h^{2}}=\sqrt{50 h^{2}}$. Applying the Pythagorean theorem to $\triangle B C D$, we get that $B C=\sqrt{h^{2}+h^{2}}=\sqrt{2 h^{2}}$. The perimeter of $\triangle A B C$ is

$$
\begin{aligned}
A B+B C+A C & =\sqrt{50 h^{2}}+\sqrt{2 h^{2}}+8 h \\
& =\sqrt{2 \times 5^{2} \times h^{2}}+\sqrt{2 h^{2}}+8 h \\
& =5 h \sqrt{2}+h \sqrt{2}+8 h \\
& =h(8+6 \sqrt{2})
\end{aligned}
$$

Since the perimeter of $\triangle A B C$ is given to be $24+18 \sqrt{2}=3(8+6 \sqrt{2})$, we conclude that $h=3$.