An explanation would be helpful, thanks!!

Check the picture below.
now, when running an altitude segment from a right-angle perpendicular to the opposite side, namely making a right-triangle on the other end, like in this case, we end up with 3 similar triangles, the Large one containing the other two, the Medium one and the Small one.
we can use proportions from the small one and large one to get "x".