I think if you understand the meaning of Ax=b it’s straightforward
Basically you have to figure out A and b
for a)
A=(1,1)
(1,-1)
and b = (5,1)
in the example
b) 2x+2=x-y → x+y=-2
then
A = (1,1)
(3,2)
b=(-2,0)
Obtaining A and b allow you to rewrite the problem in a matricial way reusing the code.