Inspired by norms of integral domains I started to think about the related diophantine equation for the norms.
Let $2 < p,q $ be given primes.
Consider the diophantine equation for positive integers
$$ a^2 + p b^2 = c^2 + p d^2 = q $$
Where $0 < a,b,c,d$ and $0 < (a-c)^2 + (b - d)^2$.
In other words we want 2 distinct representations of the prime $q$ by norms of the form $x^2 + p y^2$. This is basicly studying the norm for $\Bbb Z[\sqrt{-p}]$.
How to handle this ?
Quadratic residues probably relate to this.
Also I am unsure how this relates to $\Bbb Z[\sqrt{-p}]$ being a UFD or not , or to the the class number of it.
And I am also insecure about how it relates to Euclidean norms or multiplicative norms.
I know for instance the Gaussian integers or Eisenstein integers have multiplicative norms :
if $j,k$ are elements then $A = j k $ implies $N(A) = N(j)N(k)$.
and I know they only have one representation of a prime $q$. In fact that is used in the proof of their UFD and in justifying factoring methods for them.
It seems these 2 properties combined, implies being a UFD ?
I say combined here because I know for instance that the norm $a^2 + 17 b^2$ for the ring $\Bbb Z[\sqrt{-17}]$ is multiplicative yet the ring $\Bbb Z[\sqrt{-17}]$ is not a UFD !!
Not sure how this relates to these diophantines.
Maybe it does not relate to these diophantines or norms at all and it is just my imagination ?
Is the number of representations (here $2$) equal to the class number if the norm is multiplicative ?
I read some stuff about ring theory but I did not learn or at least did not understand how to do these things and look at them properly.
My apologies for asking maybe more than 1 thing but I suspect they are all related and understanding one implies understanding the other.
The extra questions are more a kind of context.
The main question is the diophantine and an answer to that could get the accept.
I am aware of the Brahmagupta–Fibonacci identity , but that does not answer my question(s).
For those who want to give a very general answer, I am mainly into rings that have a finite amount of units.
edit
I am aware that apparantly Euler and others came up with a method to solve the related equation but for COMPOSITE $q$.
Maybe that can help.
say $q = A q_2$
$$ a^2 + p b^2 = c^2 + p d^2 = A q_2 $$
If $0 < gcd(a,b,c,d,q_2)$ we might be in business.
Then again Euler did not even attempt the case for none-composite and the idea might miss solutions. So I am not very optimistic yet.
edit 2
A few insightful links :
Norms are always multiplicative :
When is the norm of a ring $\Bbb Z[\sqrt{-p}]$ multiplicative?
and the general equation here
A generalization of Euler Factorization with $N = m a^2 + n b^2 = m c^2 + n d^2$
( it has a bounty at the moment !)
See: Primes of the form $x^2+ny^2$?
Suppose $\mathbb{Z}[i \sqrt{p}]$ is a UFD then there is unique factorization of $q$ into prime elements in the ring.
Lets say we have unique factorization of $q$ as : $q = \prod_i z_{i}$ where $z_i$ are prime elements in the ring and various solutions come from various ways of grouping this product.
Since we have $q = (a+i\sqrt{p}b) \times (a-i\sqrt{p}b)$, 2 non-trivial factorizations exist iff $a+i\sqrt{p}b$ is not a prime element and can be further factorized assuming $\mathbb{Z}[i\sqrt{p}]$ is a UFD. This is because if $a+i\sqrt{p}b$ is a prime element there is only one unique way of combining the factorization of $q$ into solutions.
Hence, $a+i\sqrt{p}b = (c+i\sqrt{p}d) \times (c'+i\sqrt{p}d')$
But then $Norm(a+i\sqrt{p}b) = Norm(c+i\sqrt{p}d) \times Norm(c'+i\sqrt{p}d')$ which cannot be prime unless $Norm(c+i\sqrt{p}d) = 1$
But $Norm(c+i\sqrt{p}d) = 1$ has only $c = 1,-1$ as solution.
Hence there exists a unique solution if $\mathbb{Z}[i\sqrt{p}]$ is a UFD.
Check if this ring is a UFD.
Further Analysis in case the ring is not a UFD: $$a^2+pb^2 = c^2 + p d^2 = q$$
Now, $$a^2 + pb^2 = c^2 + p d^2 \implies a^2 - c^2 = p (d^2 - b^2) \implies (a+c)(a-c) = p(d^2-b^2) \implies (a+c)(a-c) = p (d^2 - b^2) = p(d+b)(d-b) $$ $$\implies \ one \ possible \ two \ solutions \ a =(p(d+b) + d-b)/2, c = (p(d+b) - (d-b))/2 \ for \ any \ b,d$$
The only thing we need to conclude is that $a^2 + pb^2 = q$ is a prime number $\implies$ for any $$q = \frac{(p(d+b) + d-b)^2}{4}+pb^2$$ a prime number, we have two different solutions.
So two solution exists if there exists a solution $d,b$ to the equation, $$q = \frac{(p(d+b) + d-b)^2}{4}+pb^2 = Norm \left(\frac{(p(d+b) + d-b)}{2}+i\sqrt{p} b \right)$$ or for some $d,b$ this number turns out to be prime.
Hence for this possible factorization of $p(d+b)(d-b)$ into $(a+c)(a-c)$, we have that, if there exists a solution $a^2+pb^2 = q$ then another solution exists iff $$a = \frac{(p(d+b) + d-b)}{2}$$ is solvable for some value of $d$. In other words iff $2a+b-pb$ is divisible by $p+1$.
By various possible factorizations of $p(d^2-b^2)$ into $(a+c)(a-c)$ and solving for $a,c$, you can find out all possibilities for existence of two solutions.