# Check that two answers are correct but not the same

**URL:** <https://cl.desmos.com/t/check-that-two-answers-are-correct-but-not-the-same/2382>\
**Category:** Questions\
**Tags:** validation, correctness\
**Created:** [January 13, 2021, 8:28pm UTC](https://cl.desmos.com/t/check-that-two-answers-are-correct-but-not-the-same/2382 "2021-01-13T20:28:33Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Megan\_Spooner](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/megan_spooner/32/1279_2.png) [@Megan\_Spooner](https://cl.desmos.com/u/Megan_Spooner)\
**Post date:** [January 13, 2021, 8:28pm UTC](https://cl.desmos.com/t/check-that-two-answers-are-correct-but-not-the-same/2382/1 "2021-01-13T20:28:34Z")

</div>

Andre and Diego each square a different number and get the same answer (4). Jada and Elena each square a different number and get the same answer (-4). Is there any way to code it so that Andre and Diego can have either -2 and 2 (doesn’t matter who has which) but that if Diego has one solution then Andre HAS to have the other and vice versa? (Same with Jada and Elena). I’m not married to any specific component (math input, table, etc), just looking for the easiest possible solution. Thanks in advance!

> **[Andre Diego Elena Jada • Activity by Megan Spooner](https://classroom.amplify.com/activity/5fff5591af7d6630173c8967)**
>
> by Megan Spooner

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [January 14, 2021, 1:19am UTC](https://cl.desmos.com/t/check-that-two-answers-are-correct-but-not-the-same/2382/2 "2021-01-14T01:19:43Z")

</div>

Just saw essentially the same thing this recent thread:

> [@Self-checking math input with two solutions](https://cl.desmos.com/t/self-checking-math-input-with-two-solutions/2379):
>
> I am creating a self-checking assignment for Algebra I where students need to find the roots/solutions of a quadratic given in standard form. Does anyone know how to allow two possible answers in a math input (so that a student could enter either intercept and be correct)? Also, how can I enter a fraction as the correct answer? See slide 9 in the activity: [https://teacher.desmos.com/activitybuilder/custom/5ffb18921488571bf77e729d](https://teacher.desmos.com/activitybuilder/custom/5ffb18921488571bf77e729d) Thanks!

---

<div class="post-metadata">

**Author:** ![Megan\_Spooner](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/megan_spooner/32/1279_2.png) [@Megan\_Spooner](https://cl.desmos.com/u/Megan_Spooner)\
**Post date:** [January 14, 2021, 2:26pm UTC](https://cl.desmos.com/t/check-that-two-answers-are-correct-but-not-the-same/2382/3 "2021-01-14T14:26:33Z")

</div>

Thank you! I’m wondering how the coding would look on the second part (highlighted in blue) if the inputs are not numeric values but latex (we are working with complex numbers, so the correct answers would be 2i and -2i.)

correct = (this.latex = `-2i` or this.latex = `2i`) and not(numericValue("\abs({input3.numericValue}-{this.numericValue})")\<=0.1)

correct: correct

initialLatex: “Elena=”

# Changes the button label from Submit to Check my work

submitLabel: “Check my work”

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [January 14, 2021, 4:25pm UTC](https://cl.desmos.com/t/check-that-two-answers-are-correct-but-not-the-same/2382/4 "2021-01-14T16:25:13Z")

</div>

Try using a simpleFunction instead of numericValue and treat `i` as a variable. Like this (with something similar in input3)

```auto
value=simpleFunction(this.latex,"i").evaluateAt(1)
check= (value=-2 or value=2) 
and not(this.numericValue=2 or this.numericValue=-2) 
and not(numericValue("\abs(${input3.script.value}-${value})"<=0.1

```

The second condition is to make sure +/- 2 is not entered.

You might be able to use `isUndefined(this.numericValue)`, but I haven’t tried it.

---

<div class="post-metadata">

**Author:** ![Megan\_Spooner](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/megan_spooner/32/1279_2.png) [@Megan\_Spooner](https://cl.desmos.com/u/Megan_Spooner)\
**Post date:** [January 14, 2021, 5:55pm UTC](https://cl.desmos.com/t/check-that-two-answers-are-correct-but-not-the-same/2382/5 "2021-01-14T17:55:28Z")

</div>

Thank you for your help! I think it’s working now. I had to take out this line:

```auto
and not(this.numericValue=2 or this.numericValue=-2) 

```

otherwise, it checked the second answer wrong every time, but when I took that out, it seemed to work just like I was hoping it would.

Thanks!

---

<div class="post-metadata">

**Author:** ![Megan\_Spooner](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/megan_spooner/32/1279_2.png) [@Megan\_Spooner](https://cl.desmos.com/u/Megan_Spooner)\
**Post date:** [January 17, 2021, 1:00am UTC](https://cl.desmos.com/t/check-that-two-answers-are-correct-but-not-the-same/2382/6 "2021-01-17T01:00:54Z")

</div>

Thought I had this, but everything is working but the last response. I have a feeling it has something to do with the coding in input6 referring back to input5 but I’m not having any luck in figuring it out. If anyone would be able to take a look and help me with the way it should be coded, I would appreciate it. The answers for Jada and Elena should be 2i and -2i.  
Thanks in advance!

> **[Andre Diego Elena Jada • Activity Builder by Desmos](https://teacher.desmos.com/activitybuilder/custom/5fff5591af7d6630173c8967)**
>
> by Megan Spooner

---

<div class="post-metadata">

**Author:** ![cwinske](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/cwinske/32/3106_2.png) [@cwinske](https://cl.desmos.com/u/cwinske)\
**Post date:** [January 17, 2021, 9:11pm UTC](https://cl.desmos.com/t/check-that-two-answers-are-correct-but-not-the-same/2382/7 "2021-01-17T21:11:13Z")

</div>

This should work for your check on input6 and it’s consistent with how you checked input5.

```auto
check= (this.latex = `2i` or this.latex = `-2i`) and not(this.latex=input5.latex)

```

---

<div class="post-metadata">

**Author:** ![Megan\_Spooner](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/megan_spooner/32/1279_2.png) [@Megan\_Spooner](https://cl.desmos.com/u/Megan_Spooner)\
**Post date:** [January 18, 2021, 1:20am UTC](https://cl.desmos.com/t/check-that-two-answers-are-correct-but-not-the-same/2382/8 "2021-01-18T01:20:18Z")

</div>

Thank you! This works like a dream!
