November 20, 1996 Pegasystems Inc. 101 Main Street Cambridge, MA 02142 Gentlemen: This opinion is delivered to you in connection with the registration statement (the "Registration Statement") on Form S-1 of Pegasystems Inc. (the "Company") filed on November 20, 1996 with the Securities and Exchange Commission by the Company under the Securities Act of 1933, as amended (the "Securities Act"), for registration under said Act of 2,581,750 shares of the common stock, $.01 par value (the "Common Stock"), of the Company. We are familiar with the Restated Articles of Organization of the Company, the corporate minute book and the Restated by-laws of the Company, and the Registration Statement. We have also made such further investigation as we have deemed necessary for the purposes of this opinion. Based upon and subject to the foregoing, we are of the opinion that the shares of Common Stock to be sold by the Company pursuant to the prospectus contained in the Registration Statement (the "Prospectus") have been validly authorized for issuance and, when issued against receipt of the purchase price described in the Prospectus, will be legally issued, fully paid and nonassessable. We understand that this opinion is to be used in connection with the Registration Statement. We consent to the filing of this opinion as an exhibit to the Registration Statement, the incorporation by reference of this opinion in any abbreviated registration statement in connection with the Common Stock pursuant to Rule 462(b) promulgated under the Securities Act, and the reference to our firm in the Prospectus under the caption "Legal Matters." Very truly yours, CHOATE, HALL & STEWART DS1/305140