If you know the lengths of two adjacent sides of the rectangle (A and b), then the length of the diagonal (C) determine very simple. Assume that the diagonal is opposite the right angle in the triangle formed by it and these two parties. This allows you to apply in the calculation of the Pythagorean theorem to calculate the diagonal length by finding the square root of the sum of squared lengths of the known sides: C=v(A?+In?).
If you know the length of only one side of the rectangle (A) and the angle (?), which with it forms a diagonal, to calculate the length of this diagonal (S) will have to use one of the direct trigonometric functions - cosine. Divide the length of the known sides into the cosine of the known angle - this will be the required length of the diagonal: C=A/cos(?).
If the rectangle specified by the coordinates of its vertices, the problem of computing the length of its diagonal is reduced to finding the distance between two points in this coordinate system. Apply the Pythagorean theorem to the triangle formed by the projection of the diagonal on each of the coordinate axes. For example, a rectangle in two-dimensional coordinates formed by the vertices A(X?;Y?), B(X?;Y?), C(X?;Y?) and D(X?;Y?). Then you need to calculate the distance between points a and C. the Length of the projection of this segment on the X-axis will be equal to the difference between the coordinates of |X?-X?|, and the projection on the Y - axis |Y?-Y?|. The angle between axes is 90°, which implies that these two projections are the legs, and the diagonal length (hypotenuse) is equal to the square root of the sum of squares of their lengths: AC=v((X?-X?)?+(Y?-Y?)?).
For finding the diagonal of a rectangle in three-dimensional coordinate system proceed as in the previous step, only adding to the formula the length of the projection on the third coordinate axis: AC=v((X?-X?)?+(Y?-Y?)?+(Z?-Z?)?).