Maybe someone has a better way (easier) to do this, ACG...but here goes nothing....[note....it looks difficult, but as we shall see, once simplified, the math is fairly straightforward....!!! ]
Let CB be the base of the triangle....its length is √ [12*2 + p^2 ]
Slope of CB = -p/12
Equation of line containing CB is
y =( -p/12) x + p multiply through by 12
12y= -px + 12p we want the form Ax + BY + C = 0...so....
px + 12y - 12p = 0
The distance from this line to (2,12) is the altitude of the triangle and is given by
l p(2) + 12(12) - 12p l / √[ p^2 + 12^2 ]
So...the area is given by
27 = (1/2) CB * altitude ....and we have.....
27 = (1/2) √ [12*2 + p^2 ] * l p(2) + 12(12) - 12p l / √[ p^2 + 12^2 ] ....simplify....
54 = l p(2) + 12(12) - 12p l
54 = l -10p + 144 l
We have these two equations
-54 = -10p + 144 ⇒ p = 99/5....reject because p must be < 12
Or...this equation....
54 = -10p + 144 subtract 144 from both sides
-90 = -10p
9 = p
Here's the proof that this is correct : https://www.wolframalpha.com/input/?i=area+of+triangle++%5B+(0,9),+(2,12),+(12,0)+%5D
