deg=9;p[x_,n_]=Sum[Subscript[a,i]*x^i,{i,0,n}];q[x_,n_]=Sum[Subscript[b,i]*x^i,{i,0,n}];ϕ[x_]=p[x,deg]/q[x,deg]s={1,-2x,x^2};upper=Table[PadLeft[PadRight[s,deg+1-i,0],deg+1,0],{i,0,deg-2}];pcoeff=Table[Subscript[a,i],{i,0,deg}]//Reverse;qcoeff=Table[Subscript[b,i],{i,0,deg}]//Reverse;M=Join[upper,{pcoeff},{qcoeff}];M//MatrixFormCollect[Det[M],x]Collect[ϕ'[x]//Together//Numerator,x]Collect[ϕ'[x]//Together//Numerator,x]==Det[M]//Expand
Out[]=
a
0
a
1
2
x
a
2
3
x
a
3
4
x
a
4
5
x
a
5
6
x
a
6
7
x
a
7
8
x
a
8
9
x
a
9
b
0
b
1
2
x
b
2
3
x
b
3
4
x
b
4
5
x
b
5
6
x
b
6
7
x
b
7
8
x
b
8
9
x
b
9
Out[]//MatrixForm=
1 | -2x | 2 x | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
0 | 1 | -2x | 2 x | 0 | 0 | 0 | 0 | 0 | 0 |
0 | 0 | 1 | -2x | 2 x | 0 | 0 | 0 | 0 | 0 |
0 | 0 | 0 | 1 | -2x | 2 x | 0 | 0 | 0 | 0 |
0 | 0 | 0 | 0 | 1 | -2x | 2 x | 0 | 0 | 0 |
0 | 0 | 0 | 0 | 0 | 1 | -2x | 2 x | 0 | 0 |
0 | 0 | 0 | 0 | 0 | 0 | 1 | -2x | 2 x | 0 |
0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | -2x | 2 x |
a 9 | a 8 | a 7 | a 6 | a 5 | a 4 | a 3 | a 2 | a 1 | a 0 |
b 9 | b 8 | b 7 | b 6 | b 5 | b 4 | b 3 | b 2 | b 1 | b 0 |
Out[]=
a
1
b
0
a
0
b
1
a
2
b
0
a
0
b
2
2
x
a
3
b
0
a
2
b
1
a
1
b
2
a
0
b
3
3
x
a
4
b
0
a
3
b
1
a
1
b
3
a
0
b
4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