Sensing tilt using accelerometer alone

sqrt((xx)+(yy)) calculates the length of the hypotenuse of a right triangle with sides X and Y (Pythagorean Theorem)

Unfortunately it gives the absolute magnitude and destroys information about quadrant. I guess you need the sign information for the various forces to determine pitch and roll correctly.