2 tan 2x + tan x = 2 (MD/AD) + (KD/AD) = CD/AD = tan 3x.

However, the addition formula for tangent gives us

tan 2x = (tan 3x - tan x)/(1 + tan x tan 3x)

and substituting this in the last equation tells us that either tan x = tan 3x or tan x tan 3x = 1, i.e., either tan x = tan 3x or tan 3x = tan (pi/2 - x). Since x is between 0 and pi/4 exclusive, the first alternative is impossible and the second implies that 4x = pi/2, so BAC is right, as desired.