Let A 1 middle school transfer x 1 color TV to A2 middle school (if x 1 is negative, A2 middle school will transfer |x 1| color TV to A 1 middle school, the same below).
A2 Middle School transfers x2 color TV to A3 Middle School; A3 Middle School transfers x3 color TV to A4 Middle School; A4 Middle School Transfers x4 Color TV to A 1 Middle School.
Color TV 15+8+5+ 12=40 sets, with an average of 10 sets per school.
∴ 15-x 1+x4= 10,8-x2+x 1= 10,5-x3+x2= 10, 12-x4+x3= 10∴x4=x 1-5,x 1=x2+2, x2=x3+5,x3=x4-2∴x4=x 1-5,x2=x 1-2,x3=x2-5=x 1-2-5=x 1-7
∵y = | x 1 |+| x2 |+| x3 | | x4 | = | x 1 |+| x 1-2 |+| x 1-7 |+| x 1-。
Where x 1 is an integer satisfying -8≤x 1≤ 15.
Let x 1=x, and consider that the function y = | x |+| x-2 |+| x-7 | | x-5 | is defined as -8 ≤
∫| x |+| x-7 | represents the sum of distances from the number x to 0 and 7. When 0≤x≤7, |x|+|x-7| takes the minimum value of 7;
Similarly, when 2≤x≤5, |x-2|+|x-5| takes the minimum value of 3,
Therefore, when 2≤x≤5, y takes the minimum value 10, that is, when x = 2,3,4,5,
| x1||| x1-2 ||| x1-7 || x1-5 | The minimum value is 10. Therefore, the minimum number of color TV sets to be transferred is 10.