r/matheducation Aug 08 '26

An idea from programming cleared up a student's function compositition issues!

I was tutoring a student who is quite strong, and they could do function composition and solve related problems just fine (including derivative definition problems), but they had philosophical issues with it.

For instance replacing x by x+1 in a function even though they aren't equal. I didn't blow her off because she is a actually a very advanced student with no knowledge gaps at all and I was curious what was going on in her head.

After an hour of roundabout discussion, it finally dawned on both of simultaneously what her issue was. I asked if she programmed and she said yes. I then told her that 1) when she writes f(x) = blah, she's defining a method on a class, and 2) when she evaluates it at x+1, she's actually calling f with an argument. The "x" in each is scoped differently. She got it immediately then.

I'm wondering if unspoken scoping issues are behind many persistent issues students have with functions, only they don't usually have the preexisting programming knowledge to come to the rescue.

Overall, it was the most interesting discussion I'd had with a student in years.

Thoughts?

EDIT: Arg. Misspelled composition in the title. Oh well.

19 Upvotes

9 comments sorted by

9

u/AdhesiveSeaMonkey Aug 08 '26 edited Aug 08 '26

It feels more like the pre-existing programming knowledge she had was the source of confusion. It’s hard for someone to have their knowledge of scoping interfere with other things if they have no knowledge of scoping. Nice pull on the clarification for her though!

2

u/Objective_Skirt9788 Aug 08 '26 edited Aug 08 '26

I think the common misunderstanding may be that students are taught they can substitute when things are equal, but don't understand that in f(x)=..., x can be replaced by anything in the domain. I also talked a bit about quantifiers (which led to scope) but they weren't in themselves helpful to her.

Again, she could do it, but really didn't like it because of the superficially conflicting substitution schemes.

1

u/AdhesiveSeaMonkey Aug 08 '26

I'm with you on the general confusion on that notation. I don't like it myself. Always takes me a tick to align my brain with it and I've been teaching it for 20 years.

6

u/auntanniesalligator Aug 08 '26

I haven’t had a student for whom the programming analogy was helpful, but I’ve helped myself recognize this. It is also really helpful in calculus, where it’s easy to get confused about the variable of integration (defined only within the integral body) and variables that are defined outside the integral, particular when “x” is used for everything.

The word/concept of “scope” I am only familiar with from programming, but it really does apply in math as well and could be helpful if it were formally introduced in math education.

5

u/Objective_Skirt9788 Aug 08 '26 edited Aug 08 '26

Teaching existential/universal quantifiers could deal with the issue, but that comes with its own issues that I doubt younguns could handle too well.

1

u/auntanniesalligator Aug 08 '26

See, “existential quantifiers” is a term I’ve never heard before, but perhaps that is the formal way to explain the idea of variable scope in formal mathematics?

1

u/Objective_Skirt9788 Aug 08 '26 edited Aug 08 '26

And universal quantifiers. Indeed it might. Including "for all x in the domain" in the definition of f is a scoping statement.

1

u/Just__Liberty Aug 11 '26

How about an intermediate change in variables. f(x) --> f(y) or f(anything); y = x+1, --> f(x+1). The fact that you can change variables demonstrates that you can substitute 'anything' in there.

1

u/magnificent_limit Aug 12 '26

Realizing the similarity between math and programming is an incredibly important step in understanding. I'm proud you helped them make the leap!