Given a positive integer n and a positive semidefinite matrix A = (Aij ) ∈ Rm×m the positive semidefinite Grothendieck problem with rank-nconstraint is (SDPn) maximize mX i=1 mX j=1 Aij xi · xj, where x1, . . . , xm ∈ Sn−1 . In this paper we design a polynomial time approximation algorithm for SDPn achieving an approximation ratio of γ(n) = 2 n „ Γ((n + 1)/2) Γ(n/2) «2 = 1 − Θ(1/n). We show that under the assumption of the unique games conjecture the achieved approximation ratio is optimal: There is no polynomial time algorithm which approximates SDPn with a ratio greater than γ(n). We improve the approximation ratio of the best known polynomial time algorithm for SDP1 from 2/π to 2/(πγ(m)) = 2/π + Θ(1/m), and we determine the optimal constant of the positive semidefinite case of a generalized Grothendieck inequality.