Why sulfur trioxide triangular while sulfur dioxide is bent?

In sulphur dioxide one of the two lone pairs of sulphur is free so it is bent, while in sulphur trioxide both the lone pairs of sulphur are involved in bond formation so it is trigonal molecule.