# Is it morally acceptable to complete math homework with a program oneself has written?

I've been trying to introduce my younger sister to programming, and one of the things I said was basically that once you know how to program, you can have a computer solve equations for you as long as you know how to program it to - including math homework. She argued that this would be unacceptable cheating.

I can see where a person would get this idea, not being familiar with programming and hearing only "homework machine". But teaching a computer to do math beyond simple operations requires a solid grasp of mathematical concepts, and requires one to effectively know the material in and out already. All that would be lost is the monotonous labor of manually punching numbers into a calculator and pushing buttons, since a conceptual understanding is required to be capable of making such a program (assuming they don't cheat on the making of the program itself and use someone else's work).

From a moral standpoint, is it acceptable to write and use a program to solve mathematical problems assigned as homework?

Would/should it be against the rules of most high schools to do this?

• Discuss it with the teacher for the corresponding class, first. – Benjamin Dickman Feb 18 '15 at 4:45
• Not exactly an answer to the ethics question, but you should remember that the point of maths homework is generally not to find out the answers, it is to practice using the technique/show your teacher how well you do/don't understand the technique. Using any other method works against this. – Jessica B Feb 18 '15 at 7:36
• @JessicaB I'd argue that the ability to program a general equation solver shows a far greater understanding of the maths underlying the technique. If it was my class, I would be for it, but I'd be worried I wasn't challenging the student sufficiently. – nickjamesuk Feb 18 '15 at 10:01
• Is it morally acceptable to assign homework so tedious and monotone that it's worth writing a program to do it? – fishlips Feb 19 '15 at 14:28
• @JessicaB In our not-so-ideal world undermining the aim of the homework does not sound very dreadful. Even if this is exam practice, why we give boring task on exams in the first place? The students probably won't use it in real life, and the whole endeavor seems like art for art's sake. – dtldarek Feb 19 '15 at 15:42

I put my recommendation first, with my reasoning about the moral basis of school and homework underneath if you are interested.

## Recommendation

It is not cheating and is probably more moral than doing the homework.

I would recommend that you and your sister consider the possible benefits of practicing manually solving the maths problems for exams or more advanced study. If she decides she doesn't need more practice, she could sound out her teacher. A really good teacher may even encourage her to do the programming as a maths/science fair project. If it sounds like the teacher won't like it, just don't tell them. See Ben Crowell's comment - most teachers will give a knee-jerk reaction rather than actually thinking about it, so why upset the teacher for no reason?

If she tells the teacher and the teacher disapproves, it really makes no difference. If she is sure she can do the maths well enough manually, it is unethical for the teacher to insist that she does more useless practice, and your sister has no ethical responsibility to obey an unethical requirement, especially when it is out of school time.

In the end, it is up to your sister to take control of her education and do what she thinks will help her learn and get qualifications and have a good all-round life. Encourage her, but if she feels uncomfortable with it, don't push it.

## General Theory of homework

The moral justification for making a student do school "work" and homework is the extent that it produces something valuable for the student, ie. skills/understanding and qualifications. School "work" has no moral value beyond this. The teacher is not an employer, and no one except the student has anything to gain by the "work". Equally, no one is disadvantaged when the student takes a short cut on doing the "work", except the student herself. "Cheating" implies that she will get something unfairly or that other students will be disadvantaged, but it should now be clear that there is no way to cheat on school work or homework (excluding summative assessments).

Therefore education needs to balance striving for deep understanding, getting formal qualifications, and minimising the opportunity cost to the student (lost time for socialising, relaxation, and extra curricular activities). It is these factors alone that usually need to be analysed in order to determine the morality of an educational activity. What the teacher wants is not really morally relevant in the calculation.

For example, in a recent meta-analysis, high homework requirements have been shown on average to have a neutral or only slight positive impact on student educational outcomes, while other studies indicate it can have a large negative effect on extra curricular activities and student health. Therefore homework itself is on shaky moral ground, and more than 2 hours of homework a day is almost certainly unethical, no matter what the teacher or school demands.

From another perspective, it is questionable how much a teacher can prescribe a student's activities outside of school grounds and school hours. Consider how upset a teacher would get if parents tried to require that students do an hour of chores during class time! Unless a student is committing fraud, whether or however your sister decides to do her homework is outside the jurisdiction of her teacher to control.

Your sister making a "homework machine" obviously leads to a deeper understanding, and increased time for extra curricular activities (if you include programming as the extra-curricular activity!), at the possible expense of being fast at manually doing those problems when she sits the test or studies more advanced work. If she is confident in solving these problems manually, then there is no issue here. An ideal teacher would have used formative assessment to determine a more profitable use of the student's time, and so wouldn't give those drills as homework in the first place.

For your sister, her moral course of action is to maximise her education while minimising the opportunity cost.

The only real moral issue would be if she used the "homework machine" to fraudulently gain an advantage on summative assessments, however, I am assuming that she would use this for homework, and not smuggle her computer into the exam.

TL;DR

Yes, as long as

• the teacher didn't explicitly forbid it,
• you wrote the mathematical core of the program yourself,
• the technique you are using doesn't twist the intent of the problem.

Teacher explicitly forbid such solutions:

In such case you are going against the teacher's will. In an ideal world the teacher will explain his motivation in a sensible way and convince you into doing the homework manually. In a less ideal world one have to decide for yourself whether the teacher is crazy or perhaps there is some reason to it. In such case I would suggest asking someone on case-by-case basis, someone more experienced who you can trust.

You didn't wrote the mathematical core of the program yourself:

There are libraries which allow you to do quite complex mathematical calculations without the understanding. To trivialize the matter, suppose the homework was to multiply two numbers, but you wrote a program:

#!/usr/bin/ruby
b = gets.to_i
a = gets.to_i
print a*b, "\n"


and that program calculated the homework for you. You don't need to know how the multiplication works to code it, in fact your homework is being solved by the code implemented by someone else. In such a case it is not alright.

The technique you are using twists the intent of the problem:

Suppose you want to find the smallest positive number $n$ such that $180\cdot n$ is a perfect cube. That is easy enough to bruteforce:

(1..180).each do |m|
if m**3 % 180 == 0 then
print m**3/180, "\n"
break
end
end


However, that would be laborious to do manually. In fact the teacher expects the student to factorize $180$ into $2^2\cdot3^2\cdot5$ and find $n = 2 \cdot 3 \cdot 5^2 = 150$. If the program would involve factorization, etc. then it could be alright, but the one above sidesteps the "hard" part by sheer force. Mathematics is a great deal about thinking and I would not find such a computer-enhanced solution appropriate.

This issue is present also in the manual solutions. For example, suppose you are given to solve some quadratic equation, but instead of using the standard formula you "guess" the roots using Wolfram Alpha, and then only check that these are the roots and that there are two of them, so you have all the solutions. Indeed such an answer "solves" the problem, but I would say that it is against the intent of the question. Please note, that it is another matter when you are given an equation like $x^2 - 20x + 99 = 0$, where you in fact can guess the roots $9$ and $11$, because these can be easily seen as the factors of the constant term.

There is a problem with knowing intentions of the teacher, but in my opinion in most cases it is clear whether the program circumvents the problem or solves it.

Otherwise:

If the above cases do not apply, then the ability to code such a program shows an understanding that covers at least the homework and probably much more. I would happily applaud such a method. We live in a world where mindless calculation practice stops being useful and the importance of long division algorithm comes not from it intrinsic value of calculating quotients, but from being a step to more general and abstract algorithms further on. If the student is able to come up with a general solution to a range of problems and code it down, then he/she is clearly ahead in this journey.

I hope this helps $\ddot\smile$

• Just to nitpick :-), in your opinion, what is the purpose of these problems that is subverted by an intelligent algorithm? For example, guessing 9 and 11 is a cheat to make it easier for kids. Real applications never have integer coefficients! Even up to calculus - especially considering that most real applications are only amenable to numeric solutions, implementing an algorithm actually brings the student closer to the true meaning of calculus. – Richard Feb 18 '15 at 21:14
• @Richard The quadratic equation is a silly example and it came out not in the way I intended. I wanted to convey that it's not the guessing that is wrong, but obtaining unguessable things from someone's else solution/algorithm. To what part you refer with "what is the purpose of these problems that is subverted by an intelligent algorithm?" – dtldarek Feb 18 '15 at 22:36
• I'm not criticising your example, just having fun. I personally do not see the point of the toy algebra or calculus that is currently taught in schools. IMHO, nearly every aspect can be taught faster and more deeply with programming. Spreadsheets, Python, Wolfram Alpha... these things are not only great learning tools but also represent the maths that students need to be mathematically literate in the real world. So no criticism of you, simply of the curricula that cause teachers to give homework so mindless that a kid can program a computer to do it! – Richard Feb 18 '15 at 23:35
• BTW, like your smiley – Richard Feb 18 '15 at 23:37

I agree with Richard and dtldarek.

Actually, back in 1988, I did use a computer to do some of my homework this way and my math teacher had no objections. It was a boring task to create diagrams for some elementary functions by hand in order to better understand their properties. I made a BASIC :-) program for each of them, then printed them out and glued into my workbook.

This way I could compute ten times more points (more smooth curves) than the homework asked for in less time, which I was proud of. I could even play with parameters and make more variants of them just for fun. Nobody doing this manually would come to the idea to do that extra drawing.

Conclusion: If the homework problem allows the benefit and you want to - program the computer. If the aim is at logic, don't brute force.

2 equations in 2 unknowns. There are no fewer than 3 ways to solve this. Similarly, there are many ways to solve for the roots (the x axis intercepts) of a quadratic equation.

On a multiple choice test, such as the SATs, the college entrance exam in the US, the question is moot. Not so much for lack of the ability to consult the computer, but for the fact that no 'work' need be shown as part of the answer.

In the case of homework or a class exam, it's frequently the case that work has to be shown. The process of learning the different ways to solve these problems is as important as reaching the correct solution. Your sister's software, while perhaps brilliant, skips over this pedagogical multi-process approach. I'd question whether the same level of understanding is even achieved, as computer's programs can be written to 'brute force' solutions with no understanding by the programmer of any of the methods the teacher is trying to teach.

The student is doing herself a disservice to use this for homework, morality aside.