Can $3p^4-3p^2+1$ be square number?

Partial solution if $p$ is prime.

Write $$3p^4-3p^2+1=n^2\implies 3p^2(p^2-1) = (n-1)(n+1)$$

If $p\ne 2$ (which is not a solution) then $p^2\mid n-1$ or $p^2\mid n+1 $

First case: If $p^2\mid n-1$ then $n+1\mid 3p^2-3$ so $ n-1= p^2k$ and $n+1\leq 3p^2-3$.

If $k\geq 3$ then $$3p^2-3\geq n+1 >n-1 \geq 3p^2$$ which is impossible. So $k\leq 2$

$\bullet$ If $k=2$ then $n= 2p^2+1$ so $$2p^2+2\mid 3p^2-3 \implies 2p^2+2\mid 2(3p^2-3)-3(2p^2+2) = -12$$

So $p^2+1\mid 6 \implies p^2+1\in \{1,2,3,6\}$ which is impssible.

$\bullet$ If $k=1$ then $n= p^2+1$ so $$p^2+2\mid 3p^2-3 \implies p^2+2\mid (3p^2-3)-3(p^2+2) =-9 $$

So $p^2+2\mid 9 \implies p^2+2\in \{1,3,9\}$ which is impossible again.

Second case: If $p^2\mid n+1$ then $n-1\mid 3p^2-3$ so $ n+1= p^2k$ and $n-1\leq 3p^2-3$.

Again, if $k\geq 3$ then $$3p^2-3\geq n-1 = n+1-2\geq 3p^2-2$$ which is impossible. So $k\leq 2$

$\bullet$ If $k=2$ then $n= 2p^2-1$ so $2p^2-2\mid 3p^2-3$ which is impossible.

$\bullet$ If $k=1$ then $n= p^2-1$ so $$p^2-2\mid 3p^2-3 \implies p^2-2\mid (3p^2-3)-3(p^2-2) =3 $$

So $p^2-2\mid 3 \implies p^2-2\in \{-1,1,3\}$ which is impossible again.

So the answer is negative if $p$ is prime.


For the equation $s^2=3p^4-3p^2+1$, substitute $$u=\frac{1}{p},v= \frac{s}{p^2}.$$ Then $v^2=u^4-3u^2+3$ and therefore $4v^2=4u^4-12u^2+12$. Let $2v=2u^2-X$ and then $$4(X-3)u^2=X^2-12.$$ Then $(X^2-12)(X-3)$ is a rational square and the original equation has been transformed into $$Y^2=X^3-3X^2-12X+36.$$ In this form the equation can be solved e.g. by Maple or Sage.

This elliptic curve has rank $0$ and solutions $(0,\pm 6),( 3,0),(4,\pm2)$. These give the only solution as $$p=\pm 1.$$


For those interested, here is a complete solution for all integers (using a bit of theory from elliptic curves - which can be found in Silverman).

Consider the curve $$ C : y^2 = 3x^4 - 3x^2 + 1$$ which I claim is an elliptic curve over $\mathbb{Q}$. In particular we have that $C$ is birational to the (smooth) elliptic curve with minimal model $$E : y^2 = x^3 - 15x + 22$$ over $\mathbb{Q}$.

Thus we have a birational map $\phi : C \to E$ with birational inverse $\phi^{-1} : E \to C$ (both defined over $\mathbb{Q}$), so the only rational points on $C$ are the image of $E(\mathbb{Q})$ under $\phi^{-1}$ together with the rational base points of the map $\phi$.

Notice that $E$ has a $2$-torsion point (namely $(2,0)$), so admits a descent by 2-isogeny, and we can compute the rank of $E$ to be $0$. Thus the rational points on $E$ are only the torsion points.

Computing the torsion subgroup is easy (via, e.g., Nagell-Lutz or Formal Groups) and we see that the torsion is of order $6$, generated by $P = (-1,6)$.

Using computer algebra, we compute the base points, and $\phi^{-1}(E(\mathbb{Q}))$ to see that $$C(\mathbb{Q}) = \{(0, -1), (0, 1), (-1, -1), (-1, 1), (0, -1), (1, 1)\}$$

For those interested, below is Magma code to automate this process

A2<x,y> := AffineSpace(Rationals(), 2);
C := Curve(A2, 3*x^4 - 3*x^2 + 1 - y^2);
C := ProjectiveClosure(C);
P := C![1,1,1];
assert IsNonSingular(P);

E, phi := EllipticCurve(C, P);
_, phi_i := IsInvertible(phi);
E2, phi2 := MinimalModel(E);
_, phi2_i := IsInvertible(phi2);

assert #TorsionSubgroup(E) eq 6;

Sel2 := TwoDescent(E); //2-descent
assert #Sel2 eq 1; //shows rank is 0 since E has 2-tors pt

P := E2![-1,6]; 
assert Order(P) eq 6;  //generator
pts := [P, 2*P, 3*P, 4*P, 5*P, 6*P];

im_pts := {@ @};
for pt in pts do
    Include(~im_pts, phi_i(phi2_i(pt)) );
end for;

bs_pts := BasePoints(phi);
rat_pts := im_pts join bs_pts;

rat_pts;