Bill Allombert on Wed, 04 Sep 2013 13:37:44 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: solve system of linear equations mod p - more than one solution


On Tue, Sep 03, 2013 at 08:40:19AM -0400, Mark DeBonis wrote:
> Is PARI able to solve a system of linear equations modulo p which have more
> than one solution? (there are free variables)  Can it list the complete
> solution set in some manner?  Can you choose which variables to solve for?

Yes, use matinverseimage and matker. 
For example:
? p=101;A=[1,2,3;4,5,6]*Mod(1,p);B=[7,8]~*Mod(1,p);
? S=matinverseimage(A,B)
%11 = [Mod(61,101),Mod(74,101),Mod(0,101)]~
? K=matker(A)
%12 = [Mod(1,101);Mod(99,101);Mod(1,101)]
? S+K*[lambda]~
%13 = [Mod(1,101)*lambda+Mod(61,101),Mod(99,101)*lambda+Mod(74,101),Mod(1,101)*lambda]~

Cheers,
Bill.