If you use the Pythagorean theorem to solve this, think of the tip of the building to the tip of the tip of the shadow as the hypotenuse then set it up like this, 30^2+x^2=38^2
Newton's second law is that the acceleration of an object is directly related to the net force and inversely related to its mass. Acceleration of an object depends on two things, force and mass.