I have problem with this question :/

a 2 meter high plank stands on the distanse 3 meter from a wall. Decide the shortest lenght a ladder must have to reach from the ground to the wall. (the wall and the plank is vertikal and the ground is horisontel.)

the right answer is (3 + ^3(12^0.5) (1+(4 / 12^2/3))^0.5 but i dont get it :/

i did this way:

i say that the distance from the plank to the ladder is x

L^2 = (3+x)^2 + (6/x + 2)^2

2L`= 2(3+X) + 2(6/x + 2)(-6/x^2)

L´= 0 => x4 + 3x^3 - 12x - 36 = 0

i dont know more, help please